Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a workflow looking for changelog fragments #247

Merged
merged 1 commit into from
Jun 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/fragment.yml
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 }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ See LICENCE to see the full text.

Any contribution is welcome and we only ask contributors to:
* Provide *at least* integration tests for any contribution.
* The Pull Request *MUST* contain a changelog fragment. See [Ansible documentation](https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment) about fragments.
* Create an issue for any significant contribution that would change a large portion of the code base.

## Contributors ✨
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/186_check_fragments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- GH Actions now checks that all PR contains a changelog fragment.
7 changes: 7 additions & 0 deletions hacking/NEED_FRAGMENT
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 !
23 changes: 23 additions & 0 deletions hacking/check_fragment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/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
}

FRAGMENTS=$(git fetch && git diff --name-only --diff-filter=ACMRT origin/main..HEAD | grep "changelogs/fragments")

if [ -z "$FRAGMENTS" ]; then
comment
else
approve
fi
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.12.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.13.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.14.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.9.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang