Repository navigation
Move Danger into its own Gemfile, loaded only by its workflow - #3057
ericproulx wants to merge 1 commit into
Conversation
428746e to
fedd763
Compare
fedd763 to
0f4bd77
Compare
f09ce49 to
0f4bd77
Compare
dblock
left a comment
There was a problem hiding this comment.
I’m an AI posting on behalf of @dblock.
I’m generally against replacing purpose-built tooling with custom code just to reduce dependencies. By that logic, we could replace RuboCop with scripts checking only the rules we use—but then we own the implementation, automated tests, and maintenance.
Danger is the right tool for this job. I’d rather fix danger-changelog’s false positives and missing checks, and isolate its dependencies from the main test matrix. I recently wrote One Tool for the Spell-Checking Job arguing that tools are cheap; maintaining our own replacements isn’t. The workflow permissions and secret handling are worth improving separately.
Please retain Danger and address these issues in the existing tooling and workflow rather than introducing a bespoke changelog checker.
Danger ran from the main Gemfile's :test group, which every gemfile in gemfiles/ evaluates. So each test job resolved and installed Danger's gems as well: 28 of the bundle's 90, Faraday, Octokit and kramdown among them. The `git < 6` pin (#3045) went to every bundle too. gemfiles/danger.gemfile now holds danger, danger-changelog, danger-pr-comment and the git pin, and nothing else, not even the gemspec. The main Gemfile drops them. numbata/danger-pr-comment's danger-run.yml can't pick a Gemfile, and a caller's env doesn't reach a reusable workflow. danger.yml therefore runs that workflow's steps itself, with BUNDLE_GEMFILE set on the job. The report artifact keeps the same names, so danger-comment.yml still posts the PR comment unchanged. The Dangerfile is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0f4bd77 to
561290b
Compare
Danger ReportNo issues found. |
ok the only reason I wanted Danger out is because of all the dependencies it brought in the gemfile for a single CI check. Instead, I've isolated Danger in it's own Gemfile so that it's not polluting the test env. What do you think ? |
That makes sense, let's add it as a feature to danger-pr-comment to avoid duplicating workflows, https://github.com/numbata/danger-pr-comment/pull/13, hold this while we work on that. |
|
Use #3062 |
Why
Danger ran from the main
Gemfile's:testgroup, and every gemfile ingemfiles/evaluates that file. So every test job, across the whole Rack/Rails/Ruby matrix, resolved and installed Danger's gems as well: 28 of the bundle's 90, including Faraday, Octokit and kramdown. Thegit < 6pin (#3045, for danger/danger#1560) applied to every bundle too.What changes
gemfiles/danger.gemfile(new) holdsdanger,danger-changelog,danger-pr-commentand thegit < 6pin. It has nothing else, not even the gemspec. The lockfile is already covered bygemfiles/*.lockin.gitignore.Gemfiledrops those four gems. The main bundle goes from 90 gems to 62..github/workflows/danger.ymlruns the steps ofnumbata/danger-pr-comment'sdanger-run.ymlitself, withBUNDLE_GEMFILEset on the job. That reusable workflow has no input for a Gemfile, and env set by the caller doesn't reach aworkflow_calljob. The workflow name (Danger) and the report artifact (danger-report/danger-report.json) are unchanged, sodanger-comment.ymlkeeps posting the PR comment as before. The run job now gets only the read-onlygithub.token, rather thansecrets: inherit.Dangerfileis unchanged.To run Danger locally:
BUNDLE_GEMFILE=gemfiles/danger.gemfile bundle exec danger local.Checked locally
danger dry_runfrom that bundle, with a simulatedpull_requestevent, writes a clean report for this commit. On a throwaway commit with a malformed CHANGELOG line it exits 1 and reports the danger-changelog error.bundle exec rakeon the main bundle: 379 files with no offenses, 3184 examples, 0 failures. The XML specs still pass, now that Declare rexml in the test bundle #3058 declaresrexml, which used to arrive only through Danger's kramdown.The real check is this PR's own Danger run and its comment, since a PR runs its own workflow files.
🤖 Generated with Claude Code