-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: allow for self-approvals for maintainers (#7921)
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,2 @@ | ||
.github/CODEOWNERS @keradus | ||
.github/workflows/self-approval.yml @keradus |
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,41 @@ | ||
# Flow for self-approving the PRs, used by maintainers for cases aligned between them. | ||
# To trigger it, the maintainer needs to commit and push: | ||
# $ git commit -m "self-approval" --allow-empty | ||
|
||
name: Self Approval | ||
|
||
on: | ||
- pull_request_target | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
automate: | ||
name: Automate | ||
runs-on: ubuntu-latest | ||
if: ${{ contains(fromJson('["julienfalque", "keradus", "keradus-ci", "kubawerlos", "localheinz", "Wirone"]'), github.actor) }} | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
MARKER: "self-approval" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.after }} | ||
- name: Determine whether PR should be automatically approved | ||
id: marker | ||
run: | | ||
msg=$(git show -s --format=%s ${{ github.event.after }}) | ||
echo $msg | ||
indicator=$([[ $msg == $MARKER ]] && echo yes || echo no) | ||
echo $indicator | ||
echo "indicator_value=${indicator}" >> "$GITHUB_OUTPUT" | ||
- name: Approve and enable auto-merge | ||
if: steps.marker.outputs.indicator_value == 'yes' | ||
run: | | ||
echo self-approving | ||
gh pr review --approve "$PR_URL" | ||
gh pr merge --auto --squash "$PR_URL" |