-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove API token requirement from Danger workflow #2632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d2c8786 to
01e0ede
Compare
Use secure two-workflow pattern from dblock's blog post: - First workflow runs on pull_request, executes danger dry_run without write permissions, uploads JSON report as artifact - Second workflow runs on workflow_run after first completes, downloads artifact and posts PR comment with write access This is secure because untrusted fork code never has access to write permissions. The comment workflow runs trusted code from the base branch. Inlined Dangerfile checks from ruby-grape-danger to avoid plugins that require GitHub API methods not available in dry_run mode.
360835e to
f7113a2
Compare
Apply Style/IfUnlessModifier and Performance/RegexpMatch fixes. Disable Style/SignalException for Danger's `fail` DSL method.
For fork PRs, github.event.workflow_run.pull_requests is always empty due to GitHub security restrictions. Include PR number in the danger_report.json artifact instead.
d7dc3d5 to
eb222e4
Compare
| # frozen_string_literal: true | ||
|
|
||
| danger.import_dangerfile(gem: 'ruby-grape-danger') | ||
| # Inline checks from ruby-grape-danger (avoids plugins requiring GitHub API token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this, ofc, should be moved to the https://github.com/ruby-grape/danger/blob/master/Dangerfile
| message('We really appreciate pull requests that demonstrate issues, even without a fix. That said, the next step is to try and fix the failing tests!', sticky: false) if !has_app_changes && has_spec_changes | ||
|
|
||
| # Simplified changelog check (replaces danger-changelog plugin which requires github.* methods) | ||
| # Note: toc.check! from danger-toc plugin removed (not essential for CI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is aligned with:
https://github.com/ruby-grape/danger/pull/14/files
- Add explicit PR event types (opened, synchronize, reopened) - Set artifact retention to 1 day - Fix regex patterns with word boundaries to avoid false positives
8228003 to
8c59d3e
Compare
Switch to tokenless execution using with GitHub Actions annotations for inline feedback. This eliminates the need for the grape-bot token while still providing PR feedback via workflow annotations.
Changes: