Deploy staged previews after validation#415
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4a93763c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (github.event_name == 'push' || | ||
| (github.event_name == 'pull_request' && | ||
| github.event.action != 'closed' && | ||
| github.event.pull_request.draft == false && | ||
| needs.validate_pull_request_job.result == 'success')) |
There was a problem hiding this comment.
Skip preview deployments for forked pull requests
For a pull request opened from a fork, this condition still starts build_and_deploy_job after validation, but GitHub does not expose repository secrets to fork-triggered pull_request workflows. Consequently AZURE_STATIC_WEB_APPS_API_TOKEN_WITTY_HILL_08172A210 resolves to an empty value and the required Azure deployment action fails, turning otherwise valid external-contributor PRs into failed checks. Restrict this deploy path to same-repository heads (or use a separate, safely designed preview workflow).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@codex good catch, Restrict this deploy path to same-repository heads
There was a problem hiding this comment.
Summary
- Restricted the staged Azure Static Web Apps deployment job to pull requests whose head repository matches the current repository, preventing forked PRs from attempting a secret-dependent deployment while preserving validation and same-repository previews. .github/workflows/azure-static-web-apps-witty-hill-08172a210.ymlL61-L70
- Committed the follow-up change as
d2e7900(Skip preview deployments for forked pull requests). - Created a follow-up PR titled “Skip staged preview deployments from forked PRs.”
Testing
- ✅
git diff --check - ✅
ruby -e "require 'yaml'; YAML.load_file('.github/workflows/azure-static-web-apps-witty-hill-08172a210.yml'); puts 'YAML parses'"
What changed
Validate Pull Requestsucceeds.master.pull-requests: writeand passGITHUB_TOKENso Azure Static Web Apps can publish the preview URL on the pull request.Why
PR #413 currently runs validation successfully but skips
Build and Deploy Job, so no staged preview is created.Validation
needs.validate_pull_request_job.result == 'success'.