Skip to content

Commit

Permalink
ci(changie): add CI to ensure changie new was run
Browse files Browse the repository at this point in the history
This commit adds a CI pipeline to ensure that `changie new` was run for
each PR. It also makes sure we don't forget to bump the package version
whenever a new changie release was created.
  • Loading branch information
serramatutu committed Jun 17, 2024
1 parent 2d2a48e commit e55a97e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changes/v0.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v0.1.0 - 2024-06-17
### Features
* Sync and async implementation of GraphQL and ADBC clients.
5 changes: 5 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
- label: Breaking Changes
auto: major
- label: Features
auto: minor
- label: Fixes
auto: patch
- label: Docs
auto: none
- label: Under the Hood
- label: Dependencies
- label: Security
auto: patch
newlines:
afterChangelogHeader: 1
beforeChangelogVersion: 1
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/changelog-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check CHANGELOG
on:
pull_request:
branches:
- main


jobs:
check-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python ${{ env.PYTHON_VERSION }} environment
uses: ./.github/actions/setup-python-env

- name: Check for new changie entry
run: |
CHANGES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E "\.changes/.*\.md")
if [ "$CHANGES" == "" ]; then
echo "No files added to `.changes/`. Make sure you run `changie new`.
exit 1
fi
- name: Assert CHANGELOG and package versions are the same
run:
CHANGELOG_VERSION=$(changie latest | cut -c 2-)
PACKAGE_VERSION=$(hatch version)
if [ "$CHANGELOG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "Changelog has version '$CHANGELOG_VERSION' while package has '$PACKAGE_VERSION'."
exit 1
fi

2 changes: 1 addition & 1 deletion .lefthook/commit-msg/template-checker
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

INPUT_FILE=$1

PATTERN="^((chore|ci|docs|feat|fix|perf|refactor|revert|test)(\([a-z0-9\-]+\))?(!)?(: (.*\s*)*))"
PATTERN="^((chore|ci|docs|feat|fix|perf|refactor|revert|test|version)(\([a-z0-9\-]+\))?(!)?(: (.*\s*)*))"
grep -E "$PATTERN" $INPUT_FILE
MATCH=$?

Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ All notable changes to this project will be documented in this file.

Do not edit this file manually, it is generated automatically by [changie](https://github.com/miniscruff/changie).

No releases yet, this file will be updated when generating your first release.

## v0.1.0 - 2024-06-17
### Features
* Sync and async implementation of GraphQL and ADBC clients.

0 comments on commit e55a97e

Please sign in to comment.