diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e089d22e538..0160d554ad2 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -6,6 +6,9 @@ inputs: type: description: Type of setup, `minimal` will only run the JavaScript installation. required: false + workflow_name: + description: Name of the workflow that is executing this action. + required: false runs: using: composite @@ -44,7 +47,7 @@ runs: shell: bash run: | previousCommit=${{ github.event.before }} - baseRef=${{ github.base_ref }} + baseRef=${{ inputs.workflow_name == 'process-release' && 'main' || github.base_ref }} origin=$( [[ -z $baseRef ]] && echo $previousCommit || echo "origin/$baseRef" ) yarn workspace scripts setRunVariables "$origin" diff --git a/.github/workflows/process-release.yml b/.github/workflows/process-release.yml index 6614e0cb003..b57833f3235 100644 --- a/.github/workflows/process-release.yml +++ b/.github/workflows/process-release.yml @@ -19,6 +19,8 @@ jobs: - name: Setup id: setup uses: ./.github/actions/setup + with: + workflow_name: process-release - run: yarn workspace scripts processRelease env: diff --git a/scripts/ci/setRunVariables.ts b/scripts/ci/setRunVariables.ts index abdad6a05a9..8347ea016d4 100644 --- a/scripts/ci/setRunVariables.ts +++ b/scripts/ci/setRunVariables.ts @@ -109,11 +109,13 @@ async function setRunVariables({ } if (require.main === module) { - const [origin] = process.argv.slice(2); + const [originBranch] = process.argv.slice(2); - if (!origin) { - throw new Error(`Unable to retrieve the origin: ${origin}`); + if (!originBranch) { + throw new Error( + `Unable to retrieve the origin branch: ${JSON.stringify(originBranch)}` + ); } - setRunVariables({ originBranch: origin }); + setRunVariables({ originBranch }); }