You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 30, 2025. It is now read-only.
To test things out, make a dummy entry in `CHANGELOG.md` that doesn't match the standard format and make a pull request. Iterate until green.
40
84
85
+
## Reusable Workflows
86
+
87
+
This gem provides **reusable GitHub Actions workflows** that can be referenced by any Grape project to implement standardized Danger checks with consistent reporting.
88
+
89
+
### Architecture
90
+
91
+
The workflows are separated into two stages:
92
+
93
+
1. **danger-run.yml**: Executes Danger checks and generates a report
94
+
- Runs `bundle exec danger dry_run` with your project's Dangerfile
95
+
- Generates a JSON report of check results
96
+
- Uploads the report as an artifact
97
+
98
+
2. **danger-comment.yml**: Posts/updates PR comments with results
99
+
- Downloads the Danger report artifact
100
+
- Formats and posts results as a PR comment
101
+
- Updates existing comment on subsequent runs
102
+
103
+
### Benefits of Reusable Workflows
104
+
105
+
✅ **DRY**: Define workflows once in `ruby-grape-danger`, reuse everywhere
106
+
✅ **Consistent**: All Grape projects use the same reporting format and behavior
107
+
✅ **Maintainable**: Fix a bug in the workflows once, all projects benefit automatically
108
+
✅ **Scalable**: Add new checks to any project's Dangerfile without touching workflows
1. Checks out **your project's repository** (not ruby-grape-danger)
120
+
2. Installs dependencies from **your Gemfile**
121
+
3. Runs danger using **your Dangerfile**
122
+
- Your Dangerfile imports `ruby-grape-danger`'s Dangerfile via `danger.import_dangerfile(gem: 'ruby-grape-danger')`
123
+
- The imported Dangerfile registers an `at_exit` hook for automatic reporting
124
+
- Runs your project-specific checks (added after the import)
125
+
- When Dangerfile finishes, the `at_exit` hook automatically exports the report
126
+
4. The report is uploaded as an artifact for the commenting workflow
127
+
128
+
Each project maintains its own Dangerfile with project-specific checks, while the `ruby-grape-danger` gem provides shared infrastructure for consistent reporting and workflow execution.
129
+
130
+
### Examples
131
+
132
+
- [danger-changelog](https://github.com/ruby-grape/danger-changelog) - Validates CHANGELOG format
0 commit comments