-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into enisdenjo-patch-1
- Loading branch information
Showing
4 changed files
with
79 additions
and
8 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,54 @@ | ||
name: Agenda auto-merge | ||
|
||
on: | ||
pull_request_target: | ||
types: [synchronize, opened, reopened] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: read | ||
checks: read | ||
|
||
jobs: | ||
validate-and-merge: | ||
if: ${{ github.event.pull_request.base.ref == 'main' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# SECURITY: it's critical we do not check out the source pull request! | ||
- name: Checkout the main branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
# We need wgutils to be installed | ||
- run: yarn install | ||
|
||
- name: Wait for checks to pass | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
# Give 15 seconds for any checks to register | ||
sleep 15 | ||
# Wait for checks to pass | ||
gh pr checks ${{ github.event.pull_request.number }} --fail-fast --watch --required 2>&1 || true | ||
# Now get the result in JSON | ||
CHECKS_OUTPUT="$(gh pr checks ${{ github.event.pull_request.number }} --required --json bucket --jq 'map(.bucket == "pass") | all' 2>&1 || true)" | ||
if echo "$CHECKS_OUTPUT" | grep -q "no required checks reported"; then | ||
echo "Not required: $CHECKS_OUTPUT" | ||
elif [[ "$CHECKS_OUTPUT" == "true" ]]; then | ||
echo "$CHECKS_OUTPUT" | ||
else | ||
echo "PR state failed? $CHECKS_OUTPUT" | ||
exit 1 | ||
fi | ||
- name: Automerge if wgutils approves | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
if yarn wgutils can-automerge "${{ github.event.pull_request.number }}" "${{ github.event.pull_request.head.sha }}"; then | ||
gh pr merge "${{ github.event.pull_request.number }}" --squash --auto --match-head-commit "${{ github.event.pull_request.head.sha }}" | ||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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