-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow looking for changelog fragments
Closes:: #186
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
on: | ||
pull_request: | ||
|
||
name: Check changelog fragment | ||
jobs: | ||
check_fragment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Automatic Rebase | ||
run: ./hacking/check_fragment.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_NUMBER: ${{ github.event.number }} |
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Dear contributor, | ||
|
||
Thank you for you Pull Request ! | ||
To ease the work of maintainers you need to add a [changelog fragment](https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment) in you PR. | ||
|
||
It will help your change be released faster ! | ||
Thank you ! |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
function comment() { | ||
echo "No fragment detected" | ||
if [ -n "$PR_NUMBER" ]; then | ||
gh pr review $PR_NUMBER -r -F $(git rev-parse --show-toplevel)/hacking/NEED_FRAGMENT | ||
fi | ||
exit 1 | ||
} | ||
|
||
function approve() { | ||
if [ -n "$PR_NUMBER" ]; then | ||
gh pr review $PR_NUMBER -a | ||
fi | ||
} | ||
|
||
if [ -z "$GITHUB_BASE_REF" ]; then | ||
GITHUB_BASE_REF="origin/main" | ||
fi | ||
|
||
echo "Comparing HEAD with $GITHUB_BASE_REF" | ||
|
||
FRAGMENTS=$(git diff --name-only --diff-filter=ACMRT $GITHUB_BASE_REF..HEAD | grep "changelogs/fragments") | ||
|
||
if [ -z "$FRAGMENTS" ]; then | ||
comment | ||
else | ||
aprove | ||
fi |