File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,10 +74,32 @@ jobs:
7474 if : ${{ always() && (needs.permissions-check.result == 'success' || needs.permissions-check.result == 'skipped') }}
7575 runs-on : ' blacksmith-8vcpu-ubuntu-2204'
7676 steps :
77+ - name : Normalize inputs
78+ id : inputs
79+ env :
80+ EVENT_NAME : ${{ github.event_name }}
81+ INPUT_REF : ${{ github.event.inputs.ref }}
82+ PAYLOAD_REF : ${{ github.event.client_payload.ref }}
83+ run : |
84+ if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
85+ echo "ref=${INPUT_REF:-main}" >> $GITHUB_OUTPUT
86+ else
87+ echo "ref=${PAYLOAD_REF:-main}" >> $GITHUB_OUTPUT
88+ fi
89+
90+ - name : Validate ref
91+ env :
92+ REF : ${{ steps.inputs.outputs.ref }}
93+ run : |
94+ if [[ ! "$REF" =~ ^(main|release/.*)$ ]]; then
95+ echo "::error::Ref '$REF' is not allowed. Only 'main' and 'release/*' branches are permitted."
96+ exit 1
97+ fi
98+
7799 - name : Checkout Repo
78100 uses : actions/checkout@v4
79101 with :
80- ref : ${{ github.event. inputs.ref || github.event.client_payload. ref || 'main' }}
102+ ref : ${{ steps. inputs.outputs. ref }}
81103 sparse-checkout : scripts/validate-staging-instances.mjs
82104 fetch-depth : 1
83105
You can’t perform that action at this time.
0 commit comments