Add Danger CI check for changelog entries
This commit adds Danger via GitHub Actions. Dangerfiles are ruby files that have a DSL for interacting with GitHub. They can do arbitrary things. See: https://danger.systems/reference.html The point of this commit is to automate the process of asking people to update the changelog. This is a really really annoying thing that we have to do too often. Editing a pull request will automatically re-run the check. Truly trivial commits can be marked as trivial easily by using the hashtag trivial in the PR body. This is really just useful for actually trivial things. Most commits actually do need to have associated changelog entries.
This commit is contained in:
parent
91bf525a4a
commit
d7bc4fdbda
2 changed files with 33 additions and 0 deletions
21
.github/workflows/danger.yml
vendored
Normal file
21
.github/workflows/danger.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
name: Danger
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [synchronize, edited, opened, reopened]
|
||||
jobs:
|
||||
run:
|
||||
name: Run danger checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 100
|
||||
submodules: 'recursive'
|
||||
- name: Install danger
|
||||
run: |
|
||||
sudo gem install danger
|
||||
- name: Run danger
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: danger
|
||||
12
Dangerfile
Normal file
12
Dangerfile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def changelog_was_not_updated?
|
||||
!git.modified_files.include? "CHANGELOG.md"
|
||||
end
|
||||
|
||||
def complicated?
|
||||
!github.pr_body.include? "#trivial"
|
||||
end
|
||||
|
||||
if changelog_was_not_updated? && complicated?
|
||||
fail "You need to update the changelog. Your pull request will not be merged until this is done."
|
||||
markdown "ProTip: Even if you think something is super simple, it should be in the changelog. Literally the only exception to this rule is if your commit isn't touching code."
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue