ci: fix GH Actions issue on release event in ensure-database-migrations-drop-columns-the-correct-way step (#5527)
This commit is contained in:
parent
b4929cfa61
commit
bf7a834e17
1 changed files with 18 additions and 5 deletions
23
.github/workflows/linting-and-tests.yml
vendored
23
.github/workflows/linting-and-tests.yml
vendored
|
|
@ -105,15 +105,28 @@ jobs:
|
||||||
id: extract_base_ref
|
id: extract_base_ref
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
|
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
|
||||||
|
RELEASE_TARGET: ${{ github.event.release.target_commitish }}
|
||||||
run: |
|
run: |
|
||||||
# Validate against safe pattern (alphanumeric, underscore, dash, dot, and forward slash only)
|
# Determine base ref from safe, pre-evaluated env variables
|
||||||
if [[ ! "${BASE_REF}" =~ ^[a-zA-Z0-9_/.-]+$ ]]; then
|
if [[ "$EVENT_NAME" == "pull_request" ]]; then
|
||||||
echo "Invalid branch name pattern detected"
|
BASE_REF="$PR_BASE_REF"
|
||||||
|
elif [[ "$EVENT_NAME" == "release" ]]; then
|
||||||
|
BASE_REF="$RELEASE_TARGET"
|
||||||
|
else
|
||||||
|
echo "Unsupported event: $EVENT_NAME"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Validate against safe pattern (alphanumeric, underscore, dash, dot, and forward slash only)
|
||||||
|
if [[ ! "$BASE_REF" =~ ^[a-zA-Z0-9_/.-]+$ ]]; then
|
||||||
|
echo "Invalid branch name pattern detected: $BASE_REF"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Store validated ref for later steps
|
# Store validated ref for later steps
|
||||||
echo "base_ref=${BASE_REF}" >> $GITHUB_OUTPUT
|
echo "base_ref=$BASE_REF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Fetch base branch
|
- name: Fetch base branch
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue