fix(ci): skip the SWA upload on Dependabot pull requests - #125
Merged
Conversation
Every Dependabot pull request on this branch has been permanently unmergeable, and would have stayed that way. The deploy step already skipped forks, on the correct reasoning that secrets are not exposed to them and the deploy would "fail confusingly rather than meaningfully". Dependabot is the same problem wearing a different hat: its pull requests run with a restricted token and no access to repository secrets, whatever branch they sit on. Those branches are in this repository, so the fork test passed, the step ran, and the action stopped with: deployment_token was not provided. Build & Deploy Frontend is a required check, so that failure blocked the merge with no way to clear it - not a stale result, not something a rebase or a re-run could fix. #123 passing the same check on the same code is the control: that branch was not Dependabot's, so the secret was there. Keyed on the pull request author rather than github.actor, because re-running a Dependabot workflow by hand makes the actor a human while the token stays restricted. Everything that gates quality still runs on those pull requests: npm ci, the audit at --audit-level=high, the frontend tests, the CSP connect-src check, and the docs drift check. Only the upload is skipped, and it could not have succeeded. Pushes to this branch and ordinary same-repo pull requests deploy exactly as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-field-054249810-125.centralus.7.azurestaticapps.net |
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.
Makes #104 and #105 mergeable. Without this, no Dependabot pull request on
frontendcan ever passBuild & Deploy Frontend— and since that is a required check, none of them can ever merge.What happens
Dependabot pull requests run with a restricted token and no access to repository secrets, whatever branch they sit on. So
secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_...arrives empty and the action stops.Why the existing guard did not catch it
The step already skipped forks, for exactly this reason:
The reasoning was right; the test was too narrow. Dependabot's branches live in this repository, so
head.repo.full_name == github.repositoryis true, the guard passed, and the step ran anyway — failing in precisely the confusing way the comment was written to prevent.The control: #123 passed this same check on the same code an hour earlier. That branch was mine rather than Dependabot's, so the secret was available. Nothing about the code differs.
This is not a stale check and not something a rebase or re-run could fix. #104 and #105 have both been recreated onto current
frontend, carry thenanoid3.3.18 fix, and are 0 commits behind — and they still fail, because this is structural.The change
Keyed on the pull request author, not
github.actor— re-running a Dependabot workflow by hand makes the actor a human while the token stays restricted.Preferred over the action's
skip_deploy_on_missing_secrets: true, which would also silently tolerate a genuinely missing secret on a real deploy. This states the condition it means.What still runs on Dependabot pull requests
Everything that gates quality:
npm cinpm audit --audit-level=highconnect-srccheckOnly the upload is skipped, and it could not have succeeded.
builddeployis the last step in the job and itsidis referenced nowhere, so the job simply succeeds. Pushes tofrontendand ordinary same-repo pull requests deploy exactly as before.After this merges
#104 and #105 need one more
@dependabot recreateso they pick up the fixed workflow on a fresh commit — check results belong to a commit, so merging this will not retroactively clear their current red X.🤖 Generated with Claude Code