-
Notifications
You must be signed in to change notification settings - Fork 185
99 lines (95 loc) · 3.41 KB
/
changelogs.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Changelogs
on:
pull_request_target:
types: [opened, edited, synchronize, reopened, closed]
# Only execute on the main branches (feature branches are excluded)
branches:
- master
# Uyuni patches
- 'Uyuni-[0-9]+.[0-9]+'
# SUSE Manager milestones
- 'Manager-[0-9]+.[0-9]+-Alpha[0-9]?'
- 'Manager-[0-9]+.[0-9]+-Beta[0-9]?'
- 'Manager-[0-9]+.[0-9]+-RC[0-9]?'
- 'Manager-[0-9]+.[0-9]+-GMC[0-9]?'
- 'Manager-[0-9]+.[0-9]+-GM[0-9]?'
# SUSE Manager releases
- 'Manager-[0-9]+.[0-9]+'
- 'Manager-[0-9]+.[0-9]+-MU-[0-9]+.[0-9]+.[0-9]+'
# Only execute on directories that have changelogs
paths:
- 'branding/**'
- 'client/**'
- 'containers/**'
- 'java/**'
- 'projects/**'
- 'proxy/**'
- 'python/**'
- 'reporting/**'
- 'schema/**'
- 'search-server/**'
- 'selinux/**'
- 'spacecmd/**'
- 'spacewalk/**'
- 'susemanager/**'
- 'susemanager-branding-oss/**'
- 'susemanager-sync-data/**'
- 'susemanager-utils/**'
- 'suseRegisterInfo/**'
- 'tftpsync/**'
- 'utils/**'
- 'uyuni/**'
- 'web/**'
jobs:
changelog_test:
name: Changelog tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}
- id: master
name: Get modified master changelog files
uses: Ana06/[email protected]
with:
filter: '*.changes'
- name: Fail if the master changelog files are modified
if: steps.master.outputs.all
run: |
echo "Master changelog files cannot be modified directly."
echo "Please revert your changes on the following master changelog file(s):"
for file in ${{steps.master.outputs.all}}
do
echo " - $file"
done
echo
echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing changelogs."
exit 1
- name: Test changelog entries
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BZ_TOKEN: ${{ secrets.BUGZILLA_TOKEN }}
GIT_REPO: ${{ github.event.pull_request.base.repo.full_name }}
PR_NUM: ${{ github.event.pull_request.number }}
TRACKER_FILE: .github/workflows/changelogs/trackers.xml
# Tracker file can be retrieved from the OBS/IBS API
# by calling 'osc api /issue_trackers/' (with authentication)
run: |
pip install python-bugzilla~=3.2.0
CHANGED_FILES=$(gh pr diff -R $GIT_REPO $PR_NUM --name-only)
python .github/workflows/changelogs/changelogs.py \
--tracker-file $TRACKER_FILE --git-repo $GIT_REPO --pr-number $PR_NUM $CHANGED_FILES
# Warns the user if they merged the PR, but the changelog test failed
warn_user_if_merged:
name: Warn user if merged
if: always() && github.event.action == 'closed' && github.event.pull_request.merged == true && needs.changelog_test.result == 'failure'
needs: changelog_test
runs-on: ubuntu-latest
steps:
- name: Remind the author with a comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
:warning: Some changelog tests have failed. @${{ github.event.pull_request.user.login }}, please review and fix the changelog issues with an additional PR.