fix(GHA): branch detection and conditional run (#59635)

This commit is contained in:
Mrugesh Mohapatra
2025-04-08 07:18:38 -05:00
committed by GitHub
parent f94a944c4e
commit 83c686aca2
+16 -3
View File
@@ -11,7 +11,6 @@ on:
jobs:
setup-jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Setup Jobs
runs-on: ubuntu-22.04
outputs:
@@ -23,8 +22,22 @@ jobs:
- name: Setup
id: setup
run: |
case "${{ github.ref }}" in
"refs/heads/prod-current")
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
BRANCH="${{ github.event.workflow_run.head_branch }}"
else
BRANCH="${{ github.ref_name }}"
fi
if [[ "${{ github.event.workflow_run.conclusion }}" != "success" ]]; then
echo "Node.js test run failed. Check logs in its workflow run. Exiting."
exit 1
fi
echo "Node.js test run succeeded. Continuing..."
echo "Current branch: $BRANCH"
case "$BRANCH" in
"prod-current")
echo "site_tld=org" >> $GITHUB_OUTPUT
echo "tgt_env_short=prd" >> $GITHUB_OUTPUT
echo "tgt_env_long=production" >> $GITHUB_OUTPUT