Skip to content

Commit cefdd9e

Browse files
Zachary-wWclaude
andcommitted
ci: avoid gh dependency in internal CI
Use the GitHub REST API with curl to fetch PR metadata so the 017 self-hosted runner does not need GitHub CLI installed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a335a70 commit cefdd9e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/internal-ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,19 @@ jobs:
7777
exit 1
7878
fi
7979
80-
PR_DATA=$(gh pr view "$PR_NUM" --json headRefOid,headRefName --repo "$GITHUB_REPOSITORY")
81-
BRANCH=$(printf '%s' "$PR_DATA" | jq -r '.headRefName')
82-
HEAD_SHA=$(printf '%s' "$PR_DATA" | jq -r '.headRefOid')
83-
8480
if ! printf '%s' "$PR_NUM" | grep -Eq '^[0-9]+$'; then
8581
echo "Invalid PR number: $PR_NUM"
8682
exit 1
8783
fi
8884
85+
PR_DATA=$(curl -fsSL \
86+
-H "Authorization: Bearer $GH_TOKEN" \
87+
-H "Accept: application/vnd.github+json" \
88+
-H "X-GitHub-Api-Version: 2022-11-28" \
89+
"https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR_NUM")
90+
BRANCH=$(printf '%s' "$PR_DATA" | jq -r '.head.ref')
91+
HEAD_SHA=$(printf '%s' "$PR_DATA" | jq -r '.head.sha')
92+
8993
SHA7=$(printf '%s' "$HEAD_SHA" | cut -c1-7)
9094
TIMESTAMP=$(date +%s)
9195
SAFE_BRANCH=$(printf '%s' "$BRANCH" | sed 's#[^A-Za-z0-9._-]#_#g' | cut -c1-120)

0 commit comments

Comments
 (0)