Skip to content

fix: use gh CLI and Bearer auth for setup action latest version fetch#1921

Merged
lpcox merged 2 commits intomainfrom
fix/setup-action-latest-auth
Apr 11, 2026
Merged

fix: use gh CLI and Bearer auth for setup action latest version fetch#1921
lpcox merged 2 commits intomainfrom
fix/setup-action-latest-auth

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented Apr 11, 2026

Problem

The Test Action (Latest Version) CI job (run 24290945171) fails with:

Fetching latest release version...
curl: (22) The requested URL returned error: 403

The action.yml uses Authorization: token when calling /repos/{owner}/{repo}/releases/latest, which returns HTTP 403 on internal repositories.

Fix

  • Primary: Use gh api CLI (pre-installed on all GitHub Actions runners) to resolve the latest release — it handles authentication natively
  • Fallback: Updated curl to use Authorization: Bearer format with proper Accept and X-GitHub-Api-Version headers

Testing

The test-action.yml workflow runs automatically on this PR.

The 'Test Action (Latest Version)' CI job fails with HTTP 403 when
fetching the latest release via the GitHub API. The root cause is
that the action uses 'Authorization: token' header format, which
can be rejected on internal repositories.

Fix:
- Use gh CLI (pre-installed on runners) as primary method for
  resolving the latest release — it handles auth natively
- Fall back to curl with the modern 'Authorization: Bearer' format
  and proper Accept/API-Version headers
- Both approaches use the GITHUB_TOKEN already available in the env

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 11, 2026 20:33
@lpcox lpcox requested a review from Mossaka as a code owner April 11, 2026 20:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the composite setup action’s “latest release” resolution so it can fetch the latest version successfully for internal repositories (where the prior GitHub API auth header format triggered HTTP 403).

Changes:

  • Switches “latest version” lookup to prefer gh api ... --jq '.tag_name' (with native GitHub authentication handling).
  • Updates the curl fallback to use Authorization: Bearer and adds recommended GitHub API headers (Accept, X-GitHub-Api-Version).
Show a summary per file
File Description
action.yml Updates the release-version discovery logic and GitHub API authentication headers to avoid 403s on internal repos.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Smoke test results (run 24291085395)

  • ✅ GitHub MCP: [WIP] Fix code for comments in review thread #1917, feat: add Copilot BYOK support via COPILOT_API_KEY
  • ✅ Playwright: github.com title contains "GitHub"
  • ✅ File write: /tmp/gh-aw/agent/smoke-test-claude-24291085395.txt created
  • ✅ Bash verify: file read successfully

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions
Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Result
GitHub API (PR list) ✅ Fetched merged PR: "feat: add Copilot BYOK support via COPILOT_API_KEY"
GitHub.com HTTP ⚠️ Pre-step data unavailable (template vars not expanded)
File write/read ⚠️ Pre-step data unavailable (template vars not expanded)

Overall: PARTIAL — GitHub API connectivity confirmed ✅; pre-computed step outputs were not injected into prompt.

Author: @lpcox

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity ✅

Service Check Result
Redis host.docker.internal:6379 PING PONG
PostgreSQL host.docker.internal:5432 pg_isready ✅ accepting connections
PostgreSQL smoketest db SELECT 1 ✅ returns 1

All checks passed. (redis-cli not installed; Redis pinged via raw socket.)

🔌 Service connectivity validated by Smoke Services

@github-actions github-actions bot mentioned this pull request Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Smoke test matrix for PR #1921:

  • GitHub MCP (last 2 merged PR titles): ✅ feat: add Copilot BYOK support via COPILOT_API_KEY; fix: harden cache-memory pipeline against exec-bit persistence and instruction injection
  • safeinputs-gh PR query (2 PRs): ❌ tool unavailable in this runtime
  • Playwright GitHub title contains "GitHub": ✅
  • Tavily search results returned: ❌ Tavily tool unavailable
  • File write/read + bash cat: ✅
  • Discussion query/comment flow: ❌ discussion-query tool unavailable
  • npm ci && npm run build: ✅
    Overall status: FAIL

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #1921 · ● 1.2M ·

@lpcox lpcox merged commit 533876b into main Apr 11, 2026
49 of 51 checks passed
@lpcox lpcox deleted the fix/setup-action-latest-auth branch April 11, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants