-
Notifications
You must be signed in to change notification settings - Fork 173
58 lines (48 loc) · 2.19 KB
/
validate-changelog.yaml
File metadata and controls
58 lines (48 loc) · 2.19 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Ensure valid and up-to-date Changelog
# Description: Automates the validation of .chloggen (CHANGELOG.md) entries ensuring:
# 1. All entries are valid.
# 2. A new entry is added for updates to chart templates or rendered example content.
# 3. Bypass validation with a 'Skip Changelog' label or a PR title containing '[chore]'.
on: pull_request
permissions:
contents: read
env:
GO_VERSION: 1.26.2
jobs:
validate-changelog:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: ${{ env.GO_VERSION }}
- name: Install chloggen
run: make install-chloggen
- name: Run make chlog-validate
run: |
if ! make chlog-validate; then
echo "Options:"
echo "- Add a Changelog Entry: Please add a '.yaml' file to the './.chloggen/' directory detailing the changes in your commit. See 'CONTRIBUTING.md' for guidance on creating this entry."
echo "- Skip the Changelog Check: If your changes don't necessitate a changelog entry or it's a minor chore, you can skip this check by:"
echo " 1. Adding '[chore]' to the title of the pull request"
echo " 2. Applying the 'Skip Changelog' label to the pull request."
exit 1
fi
- name: Read current version of the Chart
id: read-chart
run: |
version=$(yq e '.version' helm-charts/splunk-otel-collector/Chart.yaml)
echo "Current version is ${version}"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Ensure that CHANGELOG.md has an entry for the current version
id: read-changelog
run: |
if ! grep "${{ steps.read-chart.outputs.version }}" ./CHANGELOG.md ; then
echo "Missing changelog entry for ${{ steps.read-chart.outputs.version }}"
exit 1
fi