diff --git a/.github/workflows/danger-comment.yml b/.github/workflows/danger-comment.yml new file mode 100644 index 00000000..0b07e977 --- /dev/null +++ b/.github/workflows/danger-comment.yml @@ -0,0 +1,16 @@ +name: Danger Comment + +on: + workflow_run: + workflows: [Danger] + types: [completed] + +permissions: + actions: read + issues: write + pull-requests: write + +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 a45764ca..6a11b3d4 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -1,19 +1,11 @@ -name: PR Linter -on: [pull_request] +name: Danger +on: + pull_request: + types: [opened, reopened, edited, synchronize] jobs: danger: - runs-on: ubuntu-latest - env: - BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - bundler-cache: true - - run: | - # the personal token is public, this is ok, base64 encode to avoid tripping Github - TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | 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" + danger-args: "dry_run --base=origin/master" diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 6ede7d5e..93436de9 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -4,10 +4,10 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0 + ruby-version: 3.4 bundler-cache: true - run: bundle exec rubocop diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41317172..18a5d68a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,15 +6,15 @@ jobs: strategy: matrix: ruby-version: - - "3.0" - "3.1" - "3.2" - "3.3" - "3.4" + - "4.0" - "jruby-9.4" - "jruby-10" steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 184bfcb5..53a919dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### 3.1.0 (Next) * [#100](https://github.com/dblock/strava-ruby-client/pull/100): Adds comprehensive rdoc documentation - [@dblock](https://github.com/dblock). +* [#103](https://github.com/dblock/strava-ruby-client/pull/103): Migrate Danger to use the `danger-pr-comment` reusable workflow - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent). * Your contribution here. ### 3.0.0 (2025/10/24) diff --git a/Dangerfile b/Dangerfile index 228bdc2e..f2eee46c 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,4 +1,6 @@ # frozen_string_literal: true +danger.import_dangerfile(gem: 'danger-pr-comment') + toc.check! -changelog.check +changelog.check! diff --git a/Gemfile b/Gemfile index 93ea96e6..d457b803 100755 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,9 @@ gemspec group :development, :test do gem 'csv' + gem 'danger-changelog', '~> 0.8.0' + gem 'danger-pr-comment' + gem 'danger-toc', '~> 0.2.0' gem 'dotenv' gem 'faraday-retry' gem 'gpx' diff --git a/Gemfile.danger b/Gemfile.danger deleted file mode 100644 index be0fc0a4..00000000 --- a/Gemfile.danger +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://rubygems.org' - -group :test do - gem 'danger-changelog', '~> 0.4.2' - gem 'danger-toc', '~> 0.2.0', require: false -end