From 7d138f2ccea513adf45c9e366752e102f462ea9a Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Tue, 30 Dec 2025 14:21:49 -0500 Subject: [PATCH] Migrate Danger to use danger-pr-comment workflow. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Migrated from custom Danger setup to danger-pr-comment workflow framework - Replaced manual Danger workflow with reusable workflows from numbata/danger-pr-comment - Added .github/workflows/danger.yml using danger-pr-comment reusable workflow - Added .github/workflows/danger-comment.yml for posting PR comments - Updated Gemfile to include danger, danger-pr-comment, danger-changelog, and danger-toc - Updated Dangerfile to import danger-pr-comment and added changelog.check! and toc.check! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/danger-comment.yml | 11 +++++++++++ .github/workflows/danger.yml | 28 ++++++++++------------------ CHANGELOG.md | 1 + Dangerfile | 5 ++++- Gemfile | 5 ++++- 5 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/danger-comment.yml diff --git a/.github/workflows/danger-comment.yml b/.github/workflows/danger-comment.yml new file mode 100644 index 000000000..8e15cb6c1 --- /dev/null +++ b/.github/workflows/danger-comment.yml @@ -0,0 +1,11 @@ +name: Danger Comment + +on: + workflow_run: + workflows: [Danger] + types: [completed] + +jobs: + comment: + uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0 + secrets: inherit diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 12372470c..bd89a888d 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -1,21 +1,13 @@ ---- -name: danger -on: pull_request +name: Danger + +on: + pull_request: + types: [opened, reopened, edited, synchronize] jobs: danger: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 100 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.4 - bundler-cache: true - - name: Run Danger - run: | - # the token is public, has public_repo scope and belongs to the grape-bot user owned by @dblock, this is ok - TOKEN=$(echo -n Z2hwX2lYb0dPNXNyejYzOFJyaTV3QUxUdkNiS1dtblFwZTFuRXpmMwo= | base64 --decode) - DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose + uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0 + secrets: inherit + with: + ruby-version: '3.4' + bundler-cache: true diff --git a/CHANGELOG.md b/CHANGELOG.md index ce0b0f357..3a9ef9f6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * [#2648](https://github.com/ruby-grape/grape/pull/2648): Remove deprecated ParamsBuilders extensions - [@ericproulx](https://github.com/ericproulx). * [#2645](https://github.com/ruby-grape/grape/pull/2645): Endpoints are compiled when API is compiled - [@ericproulx](https://github.com/ericproulx). * [#2647](https://github.com/ruby-grape/grape/pull/2647): Explicit kwargs for `namespace` and `route_param` - [@ericproulx](https://github.com/ericproulx). +* [#2651](https://github.com/ruby-grape/grape/pull/2651): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock). * Your contribution here. #### Fixes diff --git a/Dangerfile b/Dangerfile index 82881902a..b4bc36697 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,3 +1,6 @@ # frozen_string_literal: true -danger.import_dangerfile(gem: 'ruby-grape-danger') +danger.import_dangerfile(gem: 'danger-pr-comment') + +changelog.check! +toc.check! diff --git a/Gemfile b/Gemfile index 499ba56eb..d7e491d15 100644 --- a/Gemfile +++ b/Gemfile @@ -23,10 +23,13 @@ group :development do end group :test do + gem 'danger', require: false + gem 'danger-changelog', require: false + gem 'danger-pr-comment', require: false + gem 'danger-toc', require: false gem 'rack-contrib', require: false gem 'rack-test', '~> 2.1' gem 'rspec', '~> 3.13' - gem 'ruby-grape-danger', '~> 0.2', require: false gem 'simplecov', '~> 0.21', require: false gem 'simplecov-lcov', '~> 0.8', require: false gem 'test-prof', require: false