-
Notifications
You must be signed in to change notification settings - Fork 9
80 lines (72 loc) · 2.57 KB
/
changelog.yaml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
name: CHANGELOG Validation
# author: "Guillem Gari <[email protected]>"
# description: |
# This workflow validates the CHANGELOG.md file in pull requests and can
# be manually triggered. It checks if the CHANGELOG has been updated in
# the PR and verifies its format adheres to the Keep a Changelog standard.
# Key features:
# - Runs on self-hosted Kubernetes runners
# - Triggers on pull request events (open, reopen, synchronize)
# - Checks if CHANGELOG.md has been modified in the PR
# - Validates CHANGELOG.md format (headers, versioning, sections)
# - Provides detailed error messages for failed checks
on:
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
jobs:
check-changelog-updated:
name: Check CHANGELOG Update
runs-on:
- self-hosted
- internal-robotnik
- linux
- kubernetes
steps:
- uses: actions/checkout@v4
- name: Verify CHANGELOG.md Modification
run: |
BASE_BRANCH=${{ github.base_ref }}
git fetch origin $BASE_BRANCH
if git diff --name-only origin/$BASE_BRANCH..HEAD | grep -q "CHANGELOG.md"; then
echo "CHANGELOG.md has been modified in this PR."
else
echo "Error: CHANGELOG.md has not been updated in this PR."
exit 1
fi
check-changelog-format:
name: Validate CHANGELOG Format
runs-on:
- self-hosted
- internal-robotnik
- linux
- kubernetes
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate CHANGELOG.md Format
run: |
# Check if file exists
if [ ! -f CHANGELOG.md ]; then
echo "Error: CHANGELOG.md does not exist."
exit 1
fi
# Check for "Changelog" header
if ! grep -q "# Changelog" CHANGELOG.md; then
echo "Error: CHANGELOG.md is missing the '# Changelog' header."
exit 1
fi
# Check for semantic versioning headers
if ! grep -qE "## \[?[0-9]+\.[0-9]+\.[0-9]+\]?" CHANGELOG.md; then
echo "Error: CHANGELOG.md is missing proper semantic versioning headers."
exit 1
fi
# Check for change type sections
CHANGE_TYPES=("Added" "Changed" "Deprecated" "Removed" "Fixed" "Security")
for type in "${CHANGE_TYPES[@]}"; do
if ! grep -q "### $type" CHANGELOG.md; then
echo "Warning: CHANGELOG.md is missing the '### $type' section."
fi
done
echo "CHANGELOG.md format validation passed."