Created
January 29, 2025 00:31
-
-
Save lucianoratamero/9f76e65ac0d1966ba49734e73bb18e3b to your computer and use it in GitHub Desktop.
Github action to require towncrier changelogs before merging a PR
This file contains hidden or 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
name: changelog-check | |
on: | |
- pull_request | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get base depth | |
id: base-depth | |
run: echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: ${{ steps.base-depth.outputs.base-depth }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
python -m pip install -e . | |
python -m pip install towncrier | |
- name: Check for new changelogs | |
run: | | |
git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main | |
towncrier check --compare-with origin/main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment