Danger: Fail/warn when PR targets wrong base branch#34007
Conversation
Co-authored-by: Sidnioulz <5108577+Sidnioulz@users.noreply.github.com>
…etBranch Co-authored-by: Sidnioulz <5108577+Sidnioulz@users.noreply.github.com>
|
View your CI Pipeline Execution ↗ for commit ace6ce5
☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit c08d2fe
☁️ Nx Cloud last updated this comment at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChanged the Danger GitHub Actions trigger branches from Changes
Sequence Diagram(s)mermaid Contributor->>GitHub: Open PR (base branch) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/danger-js.yml:
- Around line 10-14: The workflow currently restricts Danger runs via the
branches: list containing "main", "next", "release-*", and "*-release", which
prevents Danger from running on PRs targeting other base branches; update the
workflow trigger so Danger runs for PRs to any branch—e.g., remove or relax the
restrictive branches: block and add or modify the pull_request trigger to
include all branches (use pull_request with branches: ["**"] or omit branch
filters) so the "warn on any non-`next` target" rule executes for all PR
targets.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f168896d-4c47-424e-ba85-6e6fe65d0601
📒 Files selected for processing (2)
.github/workflows/danger-js.ymlscripts/dangerfile.js
Checklist for Contributors
Testing
Manual testing
We can create PRs to test after merging. If we want to test before merging, we need to allow the script to run on the PR branch first, and then target PRs to it. Maybe we can get away with renaming the PR branch to "release-something". LMK how you wanna proceed, @yannbf
Agent stuff
checkTargetBranchfunction toscripts/dangerfile.jsthat fails when a non-team-member PR targetsmainor a branch containingrelease, and warns when targeting anything other thannextwarnto the danger import inscripts/dangerfile.js.github/workflows/danger-js.ymlto also trigger onrelease-*and*-releasebranchescheckTargetBranchso bots (e.g. storybook-bot) with OWNER/MEMBER association are exempt from the branch checkOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.
Summary by CodeRabbit