Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta(gh): Add a status check for changelogs #700

Merged
merged 23 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Danger"
on: pull_request

jobs:
build:
name: Changelogs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npx [email protected] ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const files = danger.git.modified_files;
const hasChangelog = files.indexOf("CHANGELOG.md") !== -1;
const hasPyChangelog = files.indexOf("py/CHANGELOG.md") !== -1;

const ERROR_MESSAGE = `
Please consider adding a changelog entry for the next release:

For changes exposed to the Python package, please add an entry to \`py/CHANGELOG.md\`. This includes, but is not limited to event normalization, PII scrubbing, and the protocol.

For changes to the Relay server, please add an entry to \`CHANGELOG.md\`:
1. For new user-visible functionality under "Features"
2. For user-visible bug fixes under "Bug Fixes"
3. For features and bug fixes for internal operation (including processing mode) under "Internal"

If none of the above apply, you can opt out by adding #skip-changelog to the PR description.
`;

const skipChangelog =
danger.github &&
(danger.github.pr.body + danger.github.pr.title).includes("#skip-changelog");

if (!hasChangelog && !hasPyChangelog && !skipChangelog) {
error(ERROR_MESSAGE);
}