Skip to content

ci(jfrog): keep dependabot off the Artifactory path - #69

Merged
BernardJen merged 1 commit into
mainfrom
fix/jfrog-guard-dependabot
Sep 3, 2026
Merged

ci(jfrog): keep dependabot off the Artifactory path#69
BernardJen merged 1 commit into
mainfrom
fix/jfrog-guard-dependabot

Conversation

@BernardJen

Copy link
Copy Markdown
Contributor

The symptom

All four open dependabot PRs — #65, #66, #67, #68 — fail at the same step, in 10–17s, before a single package resolves:

[Error] got unexpected server response while attempting to get JFrog Artifactory version:
server response: 401
{"errors":[{"status":401,"message":"Authentication is required"}]}

The cause

The JFROG_ENABLED guard was written for forked PRs, the obvious secret-less case. Dependabot PRs are the non-obvious one:

  • The branch lives in this repo, so head.repo.full_name == github.repository is true and the guard waves them through. (Confirmed: head_repo=Lab271/labs-slidecue, actor=dependabot[bot].)
  • But a dependabot-triggered run is given the dependabot secret store, not the Actions one — and JF_ACCESS_TOKEN exists only as an Actions secret. The repo's dependabot secret list is empty.
  • vars are visible to dependabot, so vars.JF_URL != '' cannot gate this either.

The jf CLI therefore authenticates with nothing and gets a 401.

Why it surfaced only now

Nothing regressed — two changes landed close together:

So the first dependabot runs to see both the new workflow and the new config were the four raised this evening, and all four failed.

The fix

Add github.actor != 'dependabot[bot]' to the guard. Dependabot PRs fall back to plain npm ci against registry.npmjs.org, exactly as forked PRs already do.

Adding JF_ACCESS_TOKEN as a dependabot secret would also clear the 401, but that hands the Artifactory token to runs built from an automated dependency bump. These PRs change the lockfile; main re-resolves it through Artifactory on merge, so the dependency record is unaffected.

Note on #65

#65 is the regrouped successor to #51, which dependabot closed as superseded once the lint-and-types group from #64 took effect. Its eslint 10 peer conflict is fixed — verified locally that eslint@^10.9.0 resolves clean and lints clean on current main — but CI can't demonstrate that until this 401 is out of the way, since it fails before dependency resolution.

🤖 Generated with Claude Code

Every open dependabot PR is failing identically, before a single package
resolves:

    [Error] got unexpected server response while attempting to get JFrog
    Artifactory version: server response: 401
    {"errors":[{"status":401,"message":"Authentication is required"}]}

The JFROG_ENABLED guard was written for forked PRs, which are the obvious
secret-less case. Dependabot PRs are the non-obvious one: the branch lives in
this repo, so `head.repo.full_name == github.repository` is true and the guard
lets them onto the Artifactory path - but a dependabot-triggered run reads the
`dependabot` secret store, not the Actions one, and JF_ACCESS_TOKEN is only in
the latter. `vars` are visible to dependabot, so JF_URL alone cannot gate it.
The `jf` CLI then authenticates with nothing and gets a 401.

This only became visible now. Those PRs previously ran a ci.yml that predates
the Artifactory steps (#61), and JF_URL / JF_ACCESS_TOKEN were configured on
the repo at 17:57 and 18:00 today - so the first dependabot runs to use both
the new workflow and the new config were the four raised this evening. #65,
#66, #67 and #68 all fail at the same step for the same reason.

Adding JF_ACCESS_TOKEN as a dependabot secret would also clear the 401, but
the token is deliberately not handed to runs built from an automated
dependency bump. These PRs resolve from registry.npmjs.org instead; what they
change is the lockfile, and main re-resolves it through Artifactory on merge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@BernardJen
BernardJen merged commit 8d39530 into main Sep 3, 2026
1 check passed
@BernardJen
BernardJen deleted the fix/jfrog-guard-dependabot branch September 3, 2026 19:59
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