Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added foo
Empty file.
6 changes: 6 additions & 0 deletions scripts/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ const checkTargetBranch = () => {
const author = danger.github.pr.user;
const authorAssociation = danger.github.pr.author_association;

console.log('authorAssociation', authorAssociation);
console.log('author', author);
console.log(JSON.stringify(danger.github.pr, null, 2));

// Only check for non-team members (not OWNER, MEMBER) and skip GitHub Actions bot
if (
['OWNER', 'MEMBER'].includes(authorAssociation) ||
Expand All @@ -174,6 +178,8 @@ const checkTargetBranch = () => {
return;
}

fail(JSON.stringify(danger.github.pr, null, 2));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove the unconditional fail() before this lands.

This marks every external-contributor PR as failed even when it already targets next. .github/workflows/danger-js.yml:1-25 runs this Dangerfile for all pull_request events with no author-based skip, so non-team contributors will keep getting a red check until this line is removed or tightly scoped to the one-off debug run.

🧹 Minimal fix
-  fail(JSON.stringify(danger.github.pr, null, 2));

Based on learnings: All PRs should target the 'next' branch, not 'main'.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fail(JSON.stringify(danger.github.pr, null, 2));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/dangerfile.js` at line 181, Remove the unconditional call to
fail(JSON.stringify(danger.github.pr, null, 2)); so external PRs are not always
marked failed; either delete this line or wrap it in a conditional that only
runs for the one-off debug case (e.g., check an environment var or a specific PR
number/author/team), ensuring the use of the existing fail(...) symbol and
danger.github.pr payload is preserved only for explicit debug gating.


if (targetBranch === 'main' || targetBranch.includes('release')) {
fail(
`This PR targets \`${targetBranch}\`, but it should target \`next\`. Please update the base branch of your PR.`
Expand Down
Loading