Skip to content

Commit cef337f

Browse files
committed
Merge branch 'main' into enisdenjo-patch-1
2 parents 2bf7639 + a15947b commit cef337f

File tree

3 files changed

+78
-8
lines changed

3 files changed

+78
-8
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Agenda auto-merge
2+
3+
on:
4+
pull_request_target:
5+
types: [synchronize, opened, reopened]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: read
10+
checks: read
11+
12+
jobs:
13+
validate-and-merge:
14+
if: ${{ github.event.pull_request.base.ref == 'main' }}
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# SECURITY: it's critical we do not check out the source pull request!
19+
- name: Checkout the main branch
20+
uses: actions/checkout@v3
21+
with:
22+
ref: main
23+
24+
# We need wgutils to be installed
25+
- run: yarn install
26+
27+
- name: Wait for checks to pass
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
run: |
31+
# Give 15 seconds for any checks to register
32+
sleep 15
33+
34+
# Wait for checks to pass
35+
gh pr checks ${{ github.event.pull_request.number }} --fail-fast --watch --required 2>&1 || true
36+
# Now get the result in JSON
37+
CHECKS_OUTPUT="$(gh pr checks ${{ github.event.pull_request.number }} --required --json bucket --jq 'map(.bucket == "pass") | all' 2>&1 || true)"
38+
39+
if echo "$CHECKS_OUTPUT" | grep -q "no required checks reported"; then
40+
echo "Not required: $CHECKS_OUTPUT"
41+
elif [[ "$CHECKS_OUTPUT" == "true" ]]; then
42+
echo "$CHECKS_OUTPUT"
43+
else
44+
echo "PR state failed? $CHECKS_OUTPUT"
45+
exit 1
46+
fi
47+
48+
- name: Automerge if wgutils approves
49+
env:
50+
GH_TOKEN: ${{ github.token }}
51+
run: |
52+
if yarn wgutils can-automerge "${{ github.event.pull_request.number }}" "${{ github.event.pull_request.head.sha }}"; then
53+
gh pr merge "${{ github.event.pull_request.number }}" --squash --auto --match-head-commit "${{ github.event.pull_request.head.sha }}"
54+
fi

package-lock.json

Lines changed: 23 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"nodemon": "^2.0.20",
1818
"prettier": "^2.3.0",
1919
"spec-md": "^3.1.0",
20-
"wgutils": "^0.1.6"
20+
"wgutils": "^1.2.4"
2121
},
2222
"prettier": {
2323
"proseWrap": "always",

0 commit comments

Comments
 (0)