Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
chore: enable fork PR deployments via safe-to-deploy label (#5605)
Oleg Isonenf7bd67e5332d
diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.ymlindex 549d9a0c63..279d387579 100644--- a/.github/workflows/chromatic.yml+++ b/.github/workflows/chromatic.yml@@ -5,6 +5,8 @@ on:branches:- mainpull_request:+ pull_request_target:+ types: [labeled]# cancel in-progress runs on new commits to same PR (gitub.event.number)concurrency:@@ -16,6 +18,12 @@ permissions:jobs:chromatic:+ # Run on push, regular PR (for repo branches), or labeled PR with safe-to-deploy (for forks)+ if: |+ github.event_name == 'push' ||+ github.event_name == 'pull_request' ||+ (github.event_name == 'pull_request_target' && github.event.label.name == 'safe-to-deploy')+timeout-minutes: 20runs-on: ubuntu-latestdiff --git a/.github/workflows/main.yml b/.github/workflows/main.ymlindex 7c6c099eff..0321377564 100644--- a/.github/workflows/main.yml+++ b/.github/workflows/main.yml@@ -5,6 +5,8 @@ on:branches:- mainpull_request:+ pull_request_target:+ types: [labeled]# cancel in-progress runs on new commits to same PR (gitub.event.number)concurrency:@@ -16,6 +18,12 @@ permissions:jobs:checks:+ # Run on push, regular PR (for repo branches), or labeled PR with safe-to-deploy (for forks)+ if: |+ github.event_name == 'push' ||+ github.event_name == 'pull_request' ||+ (github.event_name == 'pull_request_target' && github.event.label.name == 'safe-to-deploy')+timeout-minutes: 20strategy:diff --git a/.github/workflows/vercel-deploy-staging.yml b/.github/workflows/vercel-deploy-staging.ymlindex 08235364a1..a96527e72b 100644--- a/.github/workflows/vercel-deploy-staging.yml+++ b/.github/workflows/vercel-deploy-staging.yml@@ -2,19 +2,44 @@ name: Vercel Deploy Stagingon:push:+ pull_request_target:+ types: [labeled, synchronize]# cancel in-progress runs on new commits to same PR (gitub.event.number)concurrency:- group: vercel-deploy-${{ github.workflow }}-${{ github.sha }}+ group: vercel-deploy-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}cancel-in-progress: truepermissions:contents: read # to fetch code (actions/checkout)statuses: write # This is required for the GitHub Script createCommitStatus to workdeployments: write+ pull-requests: write # needed to remove labels and commentjobs:+ # Remove the safe-to-deploy label when new commits are pushed to a PR (requires re-review)+ remove-label-on-update:+ if: github.event_name == 'pull_request_target' && github.event.action == 'synchronize'+ runs-on: ubuntu-latest+ steps:+ - name: Remove safe-to-deploy label+ uses: actions/github-script@v7+ with:+ script: |+ await github.rest.issues.removeLabel({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ name: 'safe-to-deploy'+ }).catch(() => {});+ console.log('Removed safe-to-deploy label due to new commits. Re-review required.');+deployment:+ # Run on push (for repo branches) OR on labeled event with safe-to-deploy label (for fork PRs)+ if: |+ github.event_name == 'push' ||+ (github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'safe-to-deploy')+# Execute development and staging on staging branches# Execute only development on all other branchesstrategy:@@ -23,7 +48,7 @@ jobs:- staging- developmentis-staging:- - ${{ endsWith(github.ref_name, '.staging') }}+ - ${{ github.event_name == 'push' && endsWith(github.ref_name, '.staging') }}exclude:- environment: stagingis-staging: false@@ -38,7 +63,7 @@ jobs:steps:- uses: actions/checkout@v4with:- ref: ${{ github.sha }}+ ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}- uses: ./.github/actions/submodules-checkoutwith:@@ -58,8 +83,8 @@ jobs:vercel-token: ${{ secrets.VERCEL_TOKEN }}vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}- ref-name: ${{ github.ref_name }}- sha: ${{ github.sha }}+ ref-name: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}+ sha: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}environment: ${{ matrix.environment }}- name: Debug Vercel Outputs@@ -80,6 +105,19 @@ jobs:description: "[${{ matrix.environment }}] Site url"url: "https://${{ steps.vercel.outputs.alias }}.${{ matrix.environment }}.webstudio.is"+ - name: Comment on PR with deployment URL+ if: github.event_name == 'pull_request_target' && matrix.environment == 'development'+ uses: actions/github-script@v7+ with:+ script: |+ const deployUrl = 'https://${{ steps.vercel.outputs.alias }}.${{ matrix.environment }}.webstudio.is';+ await github.rest.issues.createComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ body: `🚀 **Deployed!**\n\n📍 Preview: ${deployUrl}\n\n_Note: Adding new commits will remove the \`safe-to-deploy\` label and require re-approval._`+ });+outputs:builder-url: "https://${{ steps.vercel.outputs.alias }}.${{ matrix.environment }}.webstudio.is"builder-host: "${{ steps.vercel.outputs.alias }}.${{ matrix.environment }}.webstudio.is"@@ -100,4 +138,4 @@ jobs:needs: fixtures-testuses: ./.github/workflows/delete-github-deployments.ymlwith:- ref: ${{ github.ref_name }}+ ref: ${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}diff --git a/.github/workflows/vis-reg-tests.yml b/.github/workflows/vis-reg-tests.ymlindex 8f86a93431..01f653f06c 100644--- a/.github/workflows/vis-reg-tests.yml+++ b/.github/workflows/vis-reg-tests.yml@@ -5,6 +5,8 @@ on:branches:- mainpull_request:+ pull_request_target:+ types: [labeled]# cancel in-progress runs on new commits to same PR (gitub.event.number)concurrency:@@ -16,6 +18,12 @@ permissions:jobs:lost-pixel:+ # Run on push, regular PR (for repo branches), or labeled PR with safe-to-deploy (for forks)+ if: |+ github.event_name == 'push' ||+ github.event_name == 'pull_request' ||+ (github.event_name == 'pull_request_target' && github.event.label.name == 'safe-to-deploy')+timeout-minutes: 20runs-on: ubuntu-latestenv:@@ -23,8 +31,8 @@ jobs:AUTH_SECRET: teststeps:- uses: actions/checkout@v4- #with:- #ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit+ with:+ ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit- uses: ./.github/actions/ci-setup