diff --git a/.github/workflows/authorize-vercel-deploys.yml b/.github/workflows/authorize-vercel-deploys.yml index 5e53c7aa88f..6a72b23d7a6 100644 --- a/.github/workflows/authorize-vercel-deploys.yml +++ b/.github/workflows/authorize-vercel-deploys.yml @@ -1,5 +1,7 @@ name: Authorize Vercel Deploys +# This workflow is triggered by the validate-pr workflow. When it's triggered, it will run the +# authorize-vercel-deploys.yml in master branch. If you want to change it, you'll have to merge it into master. on: # only run this workflow when the validate-pr workflow completes (successfully or not) workflow_run: @@ -44,3 +46,5 @@ jobs: pnpm run authorize-vercel-deploys env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + # The SHA of the commit that triggered the validate-pr workflow + HEAD_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index b8b4226b25d..ffb9c43ca95 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -1,5 +1,6 @@ name: Validate pull request +# This workflow will trigger the authorize-vercel-deploys workflow when it's finished. on: pull_request: types: [opened, labeled, unlabeled, synchronize, ready_for_review] diff --git a/scripts/authorizeVercelDeploys.ts b/scripts/authorizeVercelDeploys.ts index 9aabfb72745..8eb8de0a337 100644 --- a/scripts/authorizeVercelDeploys.ts +++ b/scripts/authorizeVercelDeploys.ts @@ -91,9 +91,9 @@ async function authorizeVercelJob(jobInfo: JobInfo, vercelToken: string): Promis } async function main() { - const sha = process.env.GITHUB_SHA + const sha = process.env.HEAD_COMMIT_SHA if (!sha) { - throw new Error('GITHUB_SHA environment variable is required') + throw new Error('HEAD_COMMIT_SHA environment variable is required') } const vercelToken = process.env.VERCEL_TOKEN