Skip to content

Move Danger into its own Gemfile, loaded only by its workflow - #3057

Closed
ericproulx wants to merge 1 commit into
masterfrom
chore/replace-danger-with-changelog-check
Closed

ericproulx wants to merge 1 commit into
masterfrom
chore/replace-danger-with-changelog-check

Conversation

@ericproulx

@ericproulx ericproulx commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

Danger ran from the main Gemfile's :test group, and every gemfile in gemfiles/ 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. The git < 6 pin (#3045, for danger/danger#1560) applied to every bundle too.

What changes

  • gemfiles/danger.gemfile (new) holds danger, danger-changelog, danger-pr-comment and the git < 6 pin. It has nothing else, not even the gemspec. The lockfile is already covered by gemfiles/*.lock in .gitignore.
  • Gemfile drops those four gems. The main bundle goes from 90 gems to 62.
  • .github/workflows/danger.yml runs the steps of numbata/danger-pr-comment's danger-run.yml itself, with BUNDLE_GEMFILE set on the job. That reusable workflow has no input for a Gemfile, and env set by the caller doesn't reach a workflow_call job. The workflow name (Danger) and the report artifact (danger-report / danger-report.json) are unchanged, so danger-comment.yml keeps posting the PR comment as before. The run job now gets only the read-only github.token, rather than secrets: inherit.
  • Dangerfile is unchanged.

To run Danger locally: BUNDLE_GEMFILE=gemfiles/danger.gemfile bundle exec danger local.

Checked locally

  • The Danger bundle resolves to 45 gems, none of them Grape or Rack.
  • danger dry_run from that bundle, with a simulated pull_request event, 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 rake on 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 declares rexml, 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

@ericproulx
ericproulx force-pushed the chore/replace-danger-with-changelog-check branch from 428746e to fedd763 Compare November 6, 2026 17:43
@ericproulx
ericproulx marked this pull request as ready for review November 6, 2026 17:45
@ericproulx ericproulx mentioned this pull request Nov 6, 2026
2 of 3 tasks
@ericproulx
ericproulx force-pushed the chore/replace-danger-with-changelog-check branch from fedd763 to 0f4bd77 Compare November 6, 2026 17:57
@ericproulx
ericproulx requested a review from dblock November 6, 2026 17:58
@ericproulx
ericproulx force-pushed the chore/replace-danger-with-changelog-check branch from f09ce49 to 0f4bd77 Compare November 6, 2026 22:51

@dblock dblock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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>
@ericproulx
ericproulx force-pushed the chore/replace-danger-with-changelog-check branch from 0f4bd77 to 561290b Compare November 7, 2026 12:28
@ericproulx ericproulx changed the title Replace Danger with a dependency-free CHANGELOG check Move Danger into its own Gemfile, loaded only by its workflow Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@ericproulx

Copy link
Copy Markdown
Contributor Author

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.

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 ?

@dblock

dblock commented Nov 7, 2026

Copy link
Copy Markdown
Member

Allow selecting a Gemfile in Danger Run workflow numbata/danger-pr-comment#13

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.

@dblock

dblock commented Nov 7, 2026

Copy link
Copy Markdown
Member

Use #3062

@ericproulx
ericproulx deleted the chore/replace-danger-with-changelog-check branch November 8, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants