Elffuss BraidHub

kikocis/continue public

chore: fix oneper build workflow (#7189)

* test: fix PR number extraction in workflow

- Replace fragile regex parsing with GitHub API call
- Remove hardcoded fallback to 6723
- Use curl + jq instead of gh CLI for better compatibility

* clean: remove test branch trigger

* Update main-build.yaml

* Update main-build.yaml
Changeset9bb5e7aa9f0c92883d9d5fa53cec2ef5b8dd971656d438240c95d83a6ebd7d47
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-08-18 18:31 -07:00
CommitterGitHub <noreply@github.com> · 2025-08-18 18:31 -07:00
Parents3576dc2a3d6d

Browse the files at this changeset

1 file changed

modified .github/workflows/main-build.yaml +9 −7
@@ -24,17 +24,19 @@
2424
2525 - name: Get merged PR number
2626 id: get-pr
27+ env:
28+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2729 run: |
28- # Get the commit message of the merge commit
29- COMMIT_MSG=$(git log --format=%B -n 1 HEAD)
30- echo "Commit message: $COMMIT_MSG"
30+ # Get PR number for the current commit using GitHub API
31+ COMMIT_SHA=$(git rev-parse HEAD)
32+ echo "Getting PR for commit: $COMMIT_SHA"
3133
32- # Extract PR number from merge commit message (format: "Merge pull request #123 from...")
33- PR_NUMBER=$(echo "$COMMIT_MSG" | grep -o "Merge pull request #[0-9]*" | grep -o "[0-9]*" || echo "6723")
34+ PR_NUMBER=$(curl -s -H "Authorization: token $GH_TOKEN" \
35+ "https://api.github.com/repos/${{ github.repository }}/commits/$COMMIT_SHA/pulls" \
36+ | jq -r '.[0].number // empty')
3437
3538 if [ -z "$PR_NUMBER" ]; then
36- echo "❌ Could not extract PR number from commit message. This might not be a PR merge."
37- echo "Commit message was: $COMMIT_MSG"
39+ echo "❌ Could not find PR for commit $COMMIT_SHA"
3840 exit 1
3941 fi
4042