Skip to content

Commit

Permalink
Add GH action for enhanced changelog validation
Browse files Browse the repository at this point in the history
  • Loading branch information
cbbayburt committed Nov 22, 2023
1 parent 9e8ca39 commit 8c7a6db
Show file tree
Hide file tree
Showing 4 changed files with 1,380 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/changelogs.yml
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:
Expand Down Expand Up @@ -44,7 +44,7 @@ on:

jobs:
changelog_test:
name: Test changelog entries
name: Changelog tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -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'
Expand Down
Loading

0 comments on commit 8c7a6db

Please sign in to comment.