wip #309
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: Check changelog | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
outputs: | |
release_type: | |
description: The release type extracted from changelog | |
value: ${{ jobs.check_changelog.outputs.release_type }} | |
jobs: | |
check_changelog: | |
runs-on: [ ubuntu-latest ] | |
outputs: | |
release_type: ${{ steps.set_release_type_output.outputs.release_type }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Validate changelog | |
run: npm run changelog:validate | |
- name: Get release type in changelog | |
run: echo "RELEASE_TYPE=$(cat CHANGELOG.md | grep -E '^## Unreleased \[(patch|minor|major)\]$' | grep -E -w -o "patch|minor|major" | tr -d '\n')" >> $GITHUB_ENV | |
- name: Make release type available to subsequent jobs | |
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 | |
- name: Fail and display error if no proper release type is found in changelog | |
if: env.RELEASE_TYPE == '' | |
run: echo "No valid release type found in changelog. The title of the 'Unreleased' section must contain one of the following tags '[patch]', '[minor]', '[major]'. For example, '## Unreleased [minor]'."; exit 1 |