-
Notifications
You must be signed in to change notification settings - Fork 878
60 lines (50 loc) · 1.95 KB
/
changelog.yml
File metadata and controls
60 lines (50 loc) · 1.95 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
59
60
# This action requires that any PR targeting the main branch should add a
# changelog fragment file in the .changelog/ directory. If a changelog entry
# is not required, add the "Skip Changelog" label to disable this action.
name: changelog
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
permissions:
contents: read
jobs:
changelog:
runs-on: ubuntu-latest
if: |
!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')
&& github.actor != 'otelbot[bot]'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch base branch
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Ensure no direct changes to CHANGELOG.md
run: |
if [[ $(git diff --name-only FETCH_HEAD -- 'CHANGELOG.md') ]]
then
echo "CHANGELOG.md should not be directly modified."
echo "Please add a changelog fragment file to the .changelog/ directory instead."
echo "See CONTRIBUTING.md for details."
echo ""
echo "Or add the \"Skip Changelog\" label if this job should be skipped."
false
fi
- name: Install towncrier
run: pip install towncrier==25.8.0
- name: Check for changelog fragment
run: |
if ! towncrier check --compare-with origin/${{ github.base_ref }}; then
echo ""
echo "No changelog fragment found for this PR."
echo "Add a file named .changelog/${{ github.event.pull_request.number }}.<type>"
echo "where <type> is one of: added, changed, deprecated, removed, fixed"
echo "See CONTRIBUTING.md for details."
echo ""
echo "Or add the \"Skip Changelog\" label if this job should be skipped."
false
fi
- name: Preview changelog
run: towncrier build --draft --version Unreleased