Skip to content

feat: pass the job's GitHub token to analytics-cli as GITHUB_TOKEN - #155

Merged
acatxnamedvirtue merged 2 commits into
mainfrom
tylerbeebe/trunk-23480-analytics-uploader-pass-the-jobs
Nov 9, 2026
Merged

acatxnamedvirtue merged 2 commits into
mainfrom
tylerbeebe/trunk-23480-analytics-uploader-pass-the-jobs

Conversation

@acatxnamedvirtue

@acatxnamedvirtue acatxnamedvirtue commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

The github-token input (default ${{ github.token }}) was declared but never used. This exports it to analytics-cli as GITHUB_TOKEN, the same way trunk-io/login does. On a run for a pull request from a fork, with allow-forked-pr-uploads and no token, the CLI exchanges it at POST /v2/auth/github-actions/login for a Trunk login (TRUNK-23482). Fork PR uploads then work on v2 with no change to the customer's workflow. GitHub mints this token for every run, so no secret is stored.

  • The token reaches the CLI only through its environment. It is never on the command line, which appears in execSync error messages, and it is masked with core.setSecret.
  • If the input is empty, any GITHUB_TOKEN the job already has passes through unchanged.
  • The input stays with the other automatically grabbed inputs, since customers should not set it, and gets a description that says what it is for.
  • New tests cover the environment export, the empty-input case, and an end-to-end check that the token is masked and absent from the command line.

Current CLI versions ignore GITHUB_TOKEN, so this is safe to ship before TRUNK-23482. @v2 users get it only after a release and the "Update release version" workflow; v2 is already behind main.

Part of TRUNK-23480

🤖 Generated with Claude Code

acatxnamedvirtue and others added 2 commits November 6, 2026 16:55
The github-token input (default ${{ github.token }}) was declared but
never used. Export it to the CLI as GITHUB_TOKEN, as trunk-io/login
does, so a fork PR run with allow-forked-pr-uploads and no token can
exchange it for a Trunk login. The token goes through env only, never
the command line, and is masked with setSecret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Customers should not set it: ${{ github.token }} is right for every run.
It stays out of the README's parameter tables like the other inputs in
that block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trunk-staging-io

trunk-staging-io Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@acatxnamedvirtue

Copy link
Copy Markdown
Contributor Author

Closing: the v2 fork lane will swap the opted-in collection id for a Trunk login (TRUNK-23488), so analytics-cli no longer needs the job's GitHub token. The branch is kept in case the GitHub-token lane is wanted later.

@acatxnamedvirtue

Copy link
Copy Markdown
Contributor Author

Reopening: analytics-cli will swap the job's GITHUB_TOKEN at /v2/auth/github-actions/login for fork PR uploads on v2 (the flow impacted targets uses), so it needs this input again.

@acatxnamedvirtue
acatxnamedvirtue merged commit 39e806c into main Nov 9, 2026
15 checks passed
@acatxnamedvirtue
acatxnamedvirtue deleted the tylerbeebe/trunk-23480-analytics-uploader-pass-the-jobs branch November 9, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants