Improve changelog management #320
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
name: Changelog | |
on: | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
outputs: | |
release_type: | |
description: The release type extracted from changelog | |
value: ${{ jobs.validate_changelog.outputs.release_type }} | |
no_functional_changes: | |
description: A boolean indicating whether there are no functional changes in the changeset | |
value: ${{ jobs.check_functional_changes.outputs.no_functional_changes }} | |
jobs: | |
check_functional_changes: | |
runs-on: [ ubuntu-latest ] | |
outputs: | |
no_functional_changes: ${{ steps.set_no_functional_changes.outputs.no_functional_changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Make release type available to subsequent jobs # For backwards compatibility, as this workflow is used in other Open Terms Archive repositories | |
run: | | |
if grep -q "## Unreleased \[no-release\]" CHANGELOG.md; then | |
echo "NO_FUNCTIONAL_CHANGES=true" >> $GITHUB_ENV | |
fi | |
- name: Print result | |
id: set_no_functional_changes | |
run: | | |
echo "no_functional_changes='${{ env.NO_FUNCTIONAL_CHANGES }}'" | |
echo "no_functional_changes=${{ env.NO_FUNCTIONAL_CHANGES }}" >> $GITHUB_OUTPUT | |
validate_changelog: | |
if: ${{ needs.check_functional_changes.outputs.no_functional_changes != 'true' }} | |
needs: [ check_functional_changes ] | |
runs-on: [ ubuntu-latest ] | |
outputs: | |
release_type: ${{ steps.set_release_type_output.outputs.release_type }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: npm ci | |
- name: Print previous job result | |
run: | | |
echo "Result previous job: '${{ needs.check_functional_changes.outputs.no_release }}'" | |
- name: Validate changelog | |
run: npm run changelog --silent -- --validate | |
- name: Get release type in changelog | |
run: echo "RELEASE_TYPE=$(npm run changelog --silent -- --get-release-type)" >> $GITHUB_ENV | |
- name: Make release type available to subsequent jobs # For backwards compatibility, as this workflow is used in other Open Terms Archive repositories | |
if: env.RELEASE_TYPE | |
id: set_release_type_output | |
run: | | |
echo "Found release type '${{ env.RELEASE_TYPE }}'" | |
echo "release_type=${{ env.RELEASE_TYPE }}" >> $GITHUB_OUTPUT |