Debug: Debug Dangerfile PR data content (Kasper)#34400
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/dangerfile.js (1)
169-171: Prefer a targeted debug payload here.Dumping the entire
danger.github.probject makes the CI output noisy and duplicates the same payload again on Line 181. The association, author identity, PR number, and base ref should be enough for this investigation.🪵 Suggested debug payload
console.log('authorAssociation', authorAssociation); - console.log('author', author); - console.log(JSON.stringify(danger.github.pr, null, 2)); + console.log('author', { login: author.login, type: author.type }); + console.log('prDebug', { + number: danger.github.pr.number, + baseRef: targetBranch, + authorAssociation, + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/dangerfile.js` around lines 169 - 171, Replace the noisy full dump of danger.github.pr with a targeted debug payload: log authorAssociation and author as you do, then log only danger.github.pr.number and danger.github.pr.base.ref (and danger.github.pr.user.login if you need the PR author's login) instead of JSON.stringify(danger.github.pr); also remove the duplicate full-pr dump elsewhere so you only emit this concise payload once. Ensure you update the console.log calls that currently reference JSON.stringify(danger.github.pr) to the specific properties (number, base.ref, user.login) and eliminate the redundant dump.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/dangerfile.js`:
- 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.
---
Nitpick comments:
In `@scripts/dangerfile.js`:
- Around line 169-171: Replace the noisy full dump of danger.github.pr with a
targeted debug payload: log authorAssociation and author as you do, then log
only danger.github.pr.number and danger.github.pr.base.ref (and
danger.github.pr.user.login if you need the PR author's login) instead of
JSON.stringify(danger.github.pr); also remove the duplicate full-pr dump
elsewhere so you only emit this concise payload once. Ensure you update the
console.log calls that currently reference JSON.stringify(danger.github.pr) to
the specific properties (number, base.ref, user.login) and eliminate the
redundant dump.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 87843b4f-36ff-4ea2-adb5-0afc85ae220c
📒 Files selected for processing (2)
fooscripts/dangerfile.js
| return; | ||
| } | ||
|
|
||
| fail(JSON.stringify(danger.github.pr, null, 2)); |
There was a problem hiding this comment.
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.
| 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.
Summary
console.logstatements and afail()call to thecheckTargetBranchfunction inscripts/dangerfile.jsto inspect theauthor_associationvalue DangerJS receives for Kasper's PRs.foofile to ensure there is a file change for CI to pick up.This replicates the exact debug approach Steve used in PR #34398 to investigate the DangerJS
author_associationcheck that incorrectly failed on PR #34365. The goal is to verify whether DangerJS correctly recognizes Kasper'sauthor_associationasMEMBER.Test plan
authorAssociationvalue isMEMBERfail()call is or is not triggered based on the associationSummary by CodeRabbit