ci(jfrog): keep dependabot off the Artifactory path - #69
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The symptom
All four open dependabot PRs — #65, #66, #67, #68 — fail at the same step, in 10–17s, before a single package resolves:
The cause
The
JFROG_ENABLEDguard was written for forked PRs, the obvious secret-less case. Dependabot PRs are the non-obvious one:head.repo.full_name == github.repositoryis true and the guard waves them through. (Confirmed:head_repo=Lab271/labs-slidecue,actor=dependabot[bot].)dependabotsecret store, not the Actions one — andJF_ACCESS_TOKENexists only as an Actions secret. The repo's dependabot secret list is empty.varsare visible to dependabot, sovars.JF_URL != ''cannot gate this either.The
jfCLI therefore authenticates with nothing and gets a 401.Why it surfaced only now
Nothing regressed — two changes landed close together:
ci.ymlin ci(jfrog): publish build-info, and promote releases behind an approval #61. Dependabot PRs opened before that ran a workflow with noSet up JFrog CLIstep at all (verified on Bump the npm_and_yarn group across 1 directory with 3 updates #60's 18:05 run, which took the plainInstall dependenciespath and passed).JF_URLandJF_PROJECTwere set on the repo at 17:57 today,JF_ACCESS_TOKENat 18:00.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 plainnpm ciagainst registry.npmjs.org, exactly as forked PRs already do.Adding
JF_ACCESS_TOKENas 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;mainre-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-typesgroup from #64 took effect. Its eslint 10 peer conflict is fixed — verified locally thateslint@^10.9.0resolves clean and lints clean on currentmain— but CI can't demonstrate that until this 401 is out of the way, since it fails before dependency resolution.🤖 Generated with Claude Code