Skip to content

Commit 0fe9cec

Browse files
Update create_new_release.yml
1 parent b0ca4bf commit 0fe9cec

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/create_new_release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)