Skip to content

Commit

Permalink
feat: reintroduce automated changelog (#1708)
Browse files Browse the repository at this point in the history
* feat: reintroduce github_changelog_generator

* feat: more changelog tags

* feat: wholly configuring the changelog sections

* feat: changelog label auto checker

* refactor: better review messages

* debug: apply workflow on all branches to check it's working

* fix: bad env format

* fix: wrong job name

* fix: missing closing quote

* fix: bad syntax

* fix: enable shell tracing

* fix: premature failure

* fix: remove extra full stop

* debug: reenable label check only for master

* fix: missing line break escape

* refactor: use Github's default env vars for its url building

* feat: fail the github action instead of relying on a bot

* fix: remove continue-on-error

* fix: combine github action steps so it's easier to find the original error

* feat: echo error

* fix: proper error

* fix: syntax

* fix: force exit on error [ciskip]

* fix: operator precedence
  • Loading branch information
unnawut authored Sep 2, 2020
1 parent 1992805 commit 536059c
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 808 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/enforce-changelog-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Enforce changelog labels

on:
pull_request:
types: [opened, labeled, unlabeled]
branches: [master]

jobs:
enforce-changelog-label:
runs-on: ubuntu-latest
env:
# When updating the labels here, also update the `configure-sections` of the `.github_changelog_generator` file
ONE_OF_LABELS: "api|enhancement|breaking|bug|chore|documentation"
steps:
- name: Check the PR for a changelog label
id: check-changelog-label
run: |
set -o xtrace
# Using the issues API instead of pulls because it can return only the labels
curl "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/labels" \
| grep -o '"name": "[^"]*' \
| cut -d'"' -f4 \
| grep -E $ONE_OF_LABELS \
|| (echo "::error::The PR is missing a valid changelog label. Label the PR with one of: ${ONE_OF_LABELS//|/, }." && exit 1)
20 changes: 15 additions & 5 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
issues=true
issues-wo-labels=false
unreleased=false
since-tag=v0.0.1
exclude-tags=sirn-deploy
# Issue/PR filter
release-branch=master
since-tag=v0.4.8
exclude-tags-regex=.*-pre.*
unreleased=true

issues=false
pull-requests=true
pr-wo-labels=true

# Categories
pr-label=### Untagged pull requests

# When updating the sections here, also update the `ONE_OF_LABELS` env vars in the `.github/workflows/enforce-changelog-labels.yml` file
configure-sections={"api":{"prefix":"### API changes","labels":["api"]}, "breaking":{"prefix":"### Breaking changes","labels":["breaking"]}, "enhancement":{"prefix":"### Enhancements","labels":["enhancement"]}, "bug":{"prefix":"### Bug fixes","labels":["bug"]}, "chore":{"prefix":"### Chores","labels":["chore"]}, "documentation":{"prefix":"### Documentation updates","labels":["documentation"]}}

Loading

0 comments on commit 536059c

Please sign in to comment.