Add Danger configuration and enforce PR description template#111
Add Danger configuration and enforce PR description template#111kpj2006 wants to merge 2 commits intoAOSSIE-Org:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a GitHub Actions workflow and a Danger configuration to validate PR descriptions against the repository's PR template, checking required sections, issue references, and checklist items, and posting aggregated advisory messages on PRs. Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub
participant WF as Workflow<br/>`.github/workflows/danger.yml`
participant CI as Node/Danger CI
participant DF as dangerfile.js
GH->>WF: pull_request_target (opened/edited/reopened/synchronize)
WF->>WF: validate repository owner\ncheckout base branch\nsetup Node 20
WF->>CI: run `npx danger ci` (with GITHUB_TOKEN)
CI->>DF: load & execute rules
DF->>DF: validate PR body\n- check headings\n- verify issue reference\n- ensure checklist items checked
DF->>CI: return findings
CI->>GH: post/update PR comment with advisory
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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.yml:
- Around line 29-32: The Danger JS invocation currently uses an unpinned npx
call ("npx --yes danger ci"), which allows runtime package drift; change the
workflow step to pin a specific Danger version (e.g., replace "npx --yes danger
ci" with "npx --yes danger@<version> ci") or install Danger as a managed
dependency with a lockfile and run the locked script, ensuring the step that
runs Danger (the "Run Danger JS" step invoking npx) uses the pinned/locked
dependency.
In `@dangerfile.js`:
- Around line 40-46: The check that collects missingSections and appends to
issues currently only posts advisory messages; change the enforcement so
required-template violations cause CI failure by calling fail(...) instead of
message(...) or pushing to issues alone—update the block that handles
missingSections (and the similar block around the checklist handling at the
other occurrence) to call danger.fail with a clear message including the
missingSections list (e.g., use the same formatted string currently built) and
ensure any use of issues.push or message() for required items is replaced by
fail() so the PR status is blocked.
- Around line 66-70: The hard-coded array requiredChecklistItems contains
checklist strings that no longer match the PR template and causes false
negatives; update the entries in requiredChecklistItems to exactly match the
current PR template text or, better, change the matching logic used by the
checklist validator (e.g., functions referencing requiredChecklistItems) to
perform label-based or case-insensitive/trimmed substring matching instead of
strict equality so existing PRs aren't incorrectly flagged—locate the
requiredChecklistItems declaration and the validator function that checks PR
body against it and either replace the strings with the template's exact phrases
or implement tolerant matching (normalize whitespace/case or match labels).
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 10f3e83b-46dd-46ed-8e74-57465ea2193f
📒 Files selected for processing (2)
.github/workflows/danger.ymldangerfile.js
Addressed Issues:
Fixes #(issue number)
Screenshots/Recordings:
Additional Notes:
Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
Summary by CodeRabbit