-
Notifications
You must be signed in to change notification settings - Fork 32
32 lines (30 loc) · 1.31 KB
/
changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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