File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,15 +20,17 @@ jobs:
2020 create-release :
2121 runs-on : ubuntu-latest
2222 steps :
23- - name : Verify target branch exists on origin
23+ - name : Verify target branch via API
24+ env :
25+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
2426 run : |
25- set -e
26- REPO_URL="https://github.com/${{ github.repository }}.git"
27+ set -euo pipefail
2728 BR="${{ inputs.target_branch }}"
28- if ! git ls-remote --exit-code --heads "$REPO_URL" "$BR" >/dev/null; then
29- echo "❌ Branch not found on origin: $BR"
30- exit 1
31- fi
29+ URL="https://api.github.com/repos/${{ github.repository }}/branches/${BR}"
30+ code=$(curl -sS -o /dev/null -w "%{http_code}" \
31+ -H "Authorization: Bearer ${GH_TOKEN}" \
32+ -H "Accept: application/vnd.github+json" "$URL")
33+ [[ "$code" == "200" ]] || { echo "❌ Branch not found on origin: $BR"; exit 1; }
3234
3335 - name : Checkout target branch (full history for NBGV)
3436 uses : actions/checkout@v4
You can’t perform that action at this time.
0 commit comments