generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add changelog update checker workflow (#398)
* ci: add changelog update checker workflow * chore: Update .github/workflows/changelog.yml * ci: trigger changelog workflow when modifying Go files only
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<!-- | ||
PR Creation Checklist | ||
- [ ] Update Changelog | ||
Please update the CHANGELOG.md if you're modifying Go files. If your change does not require a changelog entry, please do one of the following: | ||
- add `[skip changelog]` to the PR title | ||
- label the PR with `skip/changelog` | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Changelog | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
- labeled | ||
- unlabeled | ||
paths: | ||
- '**.go' | ||
- '**/go.mod' | ||
- '**/go.sum' | ||
|
||
jobs: | ||
changelog: | ||
if: contains(github.event.pull_request.title, '[skip changelog]') == false && | ||
contains(github.event.pull_request.labels.*.name, 'skip/changelog') == false | ||
runs-on: ubuntu-latest | ||
name: Changelog | ||
steps: | ||
- id: changelog | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
ENDPOINT: repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files | ||
SELECTOR: 'map(select(.filename == "CHANGELOG.md")) | length' | ||
run: gh api "$ENDPOINT" --jq "$SELECTOR" | xargs -I{} echo "modified={}" | tee -a $GITHUB_OUTPUT | ||
- if: steps.changelog.outputs.modified == '0' | ||
env: | ||
MESSAGE: | | ||
CHANGELOG.md was not modified in this PR. Please do one of the following: | ||
- add a changelog entry | ||
- add `[skip changelog]` to the PR title | ||
- label the PR with `skip/changelog` | ||
run: | | ||
echo "::error::${MESSAGE//$'\n'/%0A}" | ||
exit 1 |