introducing towncrier
to generate changelog from fragments
#9659
Workflow file for this run
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
# This action requires that any PR targeting the main branch should touch at | |
# least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip | |
# Changelog" label to disable this action. | |
name: changelog | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, labeled, unlabeled] | |
branches: | |
- main | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo @ SHA - ${{ github.sha }} | |
uses: actions/checkout@v4 | |
- name: Fetch base branch - ${{ github.base_ref }} | |
run: git fetch origin ${{ github.base_ref }} --depth=1 | |
- name: Ensure no changes to CHANGELOG.md | |
if: | | |
!contains(github.event.pull_request.labels.*.name, 'Skip Changelog') | |
&& github.event.pull_request.user.login != 'opentelemetrybot' | |
run: | | |
# If there are any changes to CHANGELOG.md, fail. | |
if [[ $(git diff --name-only FETCH_HEAD -- 'CHANGELOG.md') ]] | |
then | |
echo "CHANGELOG.md should not be directly modified." | |
echo "Please add a entry file to the .changelog/ directory instead." | |
echo "See CONTRIBUTING.md for more details." | |
echo "Alternately, add the \"Skip Changelog\" label if this job should be skipped." | |
false | |
else | |
echo "CHANGELOG.md was not modified." | |
fi | |
- name: Ensure changelog entry addition | |
if: | | |
!contains(github.event.pull_request.labels.*.name, 'Skip Changelog') | |
&& github.event.pull_request.user.login != 'opentelemetrybot' | |
run: | | |
if [[ -z $(git diff --diff-filter=A --name-only FETCH_HEAD -- './.changelog/${{ github.event.pull_request.number }}*') ]] | |
then | |
echo "No changelog entry was added to the ./.changelog/ directory." | |
echo "Please add a changelog entry file to the ./.changelog/ directory." | |
echo "See CONTRIBUTING.md for more details." | |
echo "Alternately, add the \"Skip Changelog\" label if this job should be skipped." | |
false | |
else | |
echo "A changelog entry was added to the ./.changelog/ directory." | |
fi | |
- name: Install towncrier | |
run: pip install towncrier | |
- name: Generate changelog | |
run: towncrier build --draft --version "Unreleased" |