Skip to content

Commit e78b76b

Browse files
authored
Add Danger CI checks for pull requests (#400)
## Summary Automate pull request quality checks by adding [Danger](https://danger.systems) to the CI pipeline. This ensures every PR follows project conventions — such as including a CHANGELOG entry — before it can be merged, reducing manual review burden and keeping the project consistent. - Switch from `ruby-grape-danger` to [`danger-pr-comment`](https://github.com/numbata/danger-pr-comment), aligning with how [grape](https://github.com/ruby-grape/grape) handles PR checks - Danger results are posted as PR comments so contributors get clear, actionable feedback - Fix several historical CHANGELOG formatting issues caught by the new checks
1 parent 2ec5246 commit e78b76b

5 files changed

Lines changed: 36 additions & 6 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Danger Comment
2+
3+
on:
4+
workflow_run:
5+
workflows: [Danger]
6+
types: [completed]
7+
8+
jobs:
9+
comment:
10+
uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0
11+
secrets: inherit

.github/workflows/danger.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Danger
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, edited, synchronize]
6+
7+
jobs:
8+
danger:
9+
uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0
10+
secrets: inherit
11+
with:
12+
ruby-version: '3.4'
13+
bundler-cache: true

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#### Features
44

5+
* [#400](https://github.com/ruby-grape/grape-entity/pull/400): Switch to danger-pr-comment for PR checks - [@numbata](https://github.com/numbata).
56
* Your contribution here.
67

78
#### Fixes
@@ -15,6 +16,8 @@
1516

1617
* [#394](https://github.com/ruby-grape/grape-entity/pull/394): Add `Entity.[]` for Grape >= 3.2 param type compatibility - [@numbata](https://github.com/numbata).
1718
* [#388](https://github.com/ruby-grape/grape-entity/pull/388): Drop ruby-head from test matrix - [@numbata](https://github.com/numbata).
19+
* [#389](https://github.com/ruby-grape/grape-entity/pull/389): Block arity detection (breaking change) - [@numbata](https://github.com/numbata).
20+
* [#385](https://github.com/ruby-grape/grape-entity/pull/385): Drop multijson dependency - [@ericproulx](https://github.com/ericproulx).
1821
* [#384](https://github.com/ruby-grape/grape-entity/pull/384): Fix `inspect` to correctly handle `nil` values - [@fcce](https://github.com/fcce).
1922

2023
### 1.0.1 (2024-04-10)
@@ -28,17 +31,16 @@
2831

2932
#### Fixes
3033

31-
**Breaking change:**
32-
* [#352](https://github.com/ruby-grape/grape-entity/pull/369): Remove `FetchableObject` behavior. - [@danielvdao](https://github.com/danielvdao).
34+
* [#369](https://github.com/ruby-grape/grape-entity/pull/369): Remove `FetchableObject` behavior (breaking change) - [@danielvdao](https://github.com/danielvdao).
3335
* [#371](https://github.com/ruby-grape/grape-entity/pull/371): Allow default exposed value to be `false` or any empty data - [@norydev](https://github.com/norydev).
3436

3537

3638
### 0.10.2 (2022-07-29)
3739

3840
#### Fixes
3941

40-
* [#366](https://github.com/ruby-grape/grape-entity/pull/366): Don't suppress regular ArgumentError exceptions - [splattael](https://github.com/splattael).
41-
* [#363](https://github.com/ruby-grape/grape-entity/pull/338): Fix typo - [@OuYangJinTing](https://github.com/OuYangJinTing).
42+
* [#366](https://github.com/ruby-grape/grape-entity/pull/366): Don't suppress regular ArgumentError exceptions - [@splattael](https://github.com/splattael).
43+
* [#363](https://github.com/ruby-grape/grape-entity/pull/363): Fix typo - [@OuYangJinTing](https://github.com/OuYangJinTing).
4244
* [#361](https://github.com/ruby-grape/grape-entity/pull/361): Require 'active_support/core_ext' - [@pravi](https://github.com/pravi).
4345

4446

Dangerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# frozen_string_literal: true
22

3-
danger.import_dangerfile(gem: 'ruby-grape-danger')
3+
danger.import_dangerfile(gem: 'danger-pr-comment')
4+
5+
changelog.check!

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ end
1818

1919
group :test do
2020
gem 'coveralls_reborn', require: false
21+
gem 'danger', require: false
22+
gem 'danger-changelog', require: false
23+
gem 'danger-pr-comment', require: false
2124
gem 'growl'
2225
gem 'guard'
2326
gem 'guard-bundler'
2427
gem 'guard-rspec'
2528
gem 'rb-fsevent'
26-
gem 'ruby-grape-danger', '~> 0.2', require: false
2729
gem 'simplecov', require: false
2830
end

0 commit comments

Comments
 (0)