Update uyuni-tools.spec #146
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
# SPDX-FileCopyrightText: 2024 SUSE LLC | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Changelogs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
changelog_test: | |
name: Test changelog entries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- 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 checklogs." | |
exit 1 | |
- id: changelogs | |
name: Get modified changelog 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 == '' | |
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 | |
# 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: No changelog entry has been added. @${{ github.event.pull_request.user.login }}, please add necessary changelog entries with an additional PR. |