Skip to content

Commit

Permalink
ci: add changelog update checker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh authored and hacdias committed Jun 29, 2023
1 parent dae4183 commit f9fca38
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!--
PR Creation Checklist
- [ ] Update Changelog
Please update docs/changelogs/. 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`
-->
35 changes: 35 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Changelog

on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
- labeled
- unlabeled

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 | startswith("docs/changelogs/"))) | length'
run: gh api "$ENDPOINT" --jq "$SELECTOR" | xargs -I{} echo "modified={}" | tee -a $GITHUB_OUTPUT
- if: steps.changelog.outputs.modified == '0'
env:
MESSAGE: |
docs/changelogs/ 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

0 comments on commit f9fca38

Please sign in to comment.