-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GH action for enhanced changelog validation
- Loading branch information
Showing
4 changed files
with
1,382 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Changelogs | ||
|
||
on: | ||
pull_request_target: | ||
pull_request: | ||
types: [opened, edited, synchronize, reopened, closed] | ||
# Only execute on the main branches (feature branches are excluded) | ||
branches: | ||
|
@@ -44,7 +44,7 @@ on: | |
|
||
jobs: | ||
changelog_test: | ||
name: Test changelog entries | ||
name: Changelog tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -65,22 +65,27 @@ jobs: | |
echo " - $file" | ||
done | ||
echo | ||
echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing checklogs." | ||
echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing changelogs." | ||
exit 1 | ||
- id: changelogs | ||
name: Get modified changelog files | ||
name: Get modified files | ||
if: "!contains(github.event.pull_request.body, '[x] No changelog needed')" | ||
uses: Ana06/[email protected] | ||
with: | ||
filter: '*.changes.*' | ||
- name: Fail if no changelog entries are added | ||
if: steps.changelogs.conclusion == 'success' && steps.changelogs.outputs.added_modified == '' | ||
- name: Test changelog entries | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BZ_TOKEN: ${{ secrets.BUGZILLA_TOKEN }} | ||
run: | | ||
echo "No changelog entry found. Please add the required changelog entries." | ||
echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing checklogs." | ||
exit 1 | ||
pip install python-bugzilla~=3.2.0 | ||
# Tracker file can be retrieved from the OBS/IBS API | ||
# by calling 'osc api /issue_trackers/' (with authentication) | ||
python .github/workflows/changelogs/changelogs.py \ | ||
--tracker-file .github/workflows/changelogs/trackers.xml \ | ||
--git-repo uyuni-project/uyuni \ | ||
--pr-number ${{ github.event.pull_request.number }} \ | ||
${{ steps.changelogs.outputs.all }} | ||
# warns the user if they merged the PR, but the changelog test failed | ||
# 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' | ||
|
Oops, something went wrong.