Skip to content

GitHub Action: a missing token fails the step instead of passing quietly; VISUALCI_TOKEN from the env works too (sc-9246) - #180

Merged
ndbroadbent merged 2 commits into
mainfrom
action-require-token
Dec 4, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
action-require-token

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

sc-9246, from the case studies: a workflow that left out token: (or misnamed its secret) got a green step and no build, because the action treated every empty token as "a fork's pull request" and skipped it with a notice.

What changes

  • Where the token comes from: the token input, else VISUALCI_TOKEN from the workflow's or job's env. Every step that calls the CLI uses the same fallback.
  • No token anywhere fails the step, with an error naming both ways to pass it.
  • Skipped with a notice, only where GitHub passes no repository secrets:
    • a pull_request whose head repository differs from this one, or was deleted (a fork); the notice links to the workflow_run setup;
    • any run in a fork itself (github.event.repository.fork), so contributors' own fork CI doesn't go red;
    • Dependabot's own events (actor dependabot[bot], apart from workflow_run and pull_request_target, which get the normal secrets); the notice says to add the token to Dependabot's secrets.
  • pull_request_target, workflow_run, merge_group, schedules and pushes in this repository have secrets, so a missing token fails there.
  • CI (the clients job, on this repository's own runs only):
    • the action with no token fails at its token step, not skipped and not failing for another reason;
    • with VISUALCI_TOKEN only in env and a stub CLI, the action isn't skipped, and all three CLI calls (build create, upload, finalize) receive the token.
    • The visual and journeys jobs still cover the real path with token:.
  • The docs table and the setup paragraph describe the new behaviour. Skills are regenerated, and the plugin goes to 0.1.59.

An independent review found nothing must-fix. Its two should-fix items (Dependabot skips on events that do have secrets, and red runs in forks) and its nits (a deleted fork's PR, a sharper CI assertion, the env-only path untested, docs wording) are in f457eaa.

Release note for the next CLI tag (the action is pinned by tag, so users get this from 0.2.26): an empty token no longer skips the action outside forks and Dependabot. A workflow that relied on that (for example a scheduled job in a repository without the secret) now fails until it passes the token or drops the step.

…bot's pull request; the token can come from VISUALCI_TOKEN in the env (sc-9246)
…ecrets; runs in a fork and a deleted fork's PR skip too; CI checks the env-only token reaches every CLI call (review of sc-9246)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant