-
Notifications
You must be signed in to change notification settings - Fork 80
62 lines (52 loc) · 2.18 KB
/
automerge_plugin-only_prs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Automatically merge plugin-only PRs
# Triggered on all PRs labeled "automerge-approved"
# (Label is set by the "check_if_pr_is_automergeable" workflow)
# Confirms PR is automergeable (see check_if_pr_is_automergeable.yml for details)
# If PR is automergeable, approves and merges the PR
on:
pull_request:
types: [labeled]
permissions: write-all
jobs:
check_test_results:
name: Check if all tests have passed and PR meets automerge conditions
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'automerge-approved') && contains(github.event.pull_request.labels.*.name, 'mapping-complete')
outputs:
ALL_TESTS_PASS: ${{ steps.gettestresults.outputs.TEST_RESULTS }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get test results and ensure automergeable
id: gettestresults
run: |
echo "Checking test results for PR head $( python brainscore_vision/submission/actions_helpers.py get_pr_head )"
test_results=$( python brainscore_vision/submission/actions_helpers.py )
echo $test_results
echo "TEST_RESULTS=$test_results" >> $GITHUB_OUTPUT
automerge:
name: If tests pass and PR is automergeable, approve and merge
runs-on: ubuntu-latest
needs: check_test_results
if: needs.check_test_results.outputs.ALL_TESTS_PASS == 'True'
steps:
- name: Auto Approve
uses: hmarr/[email protected]
- name: Auto Merge (GitHub submissions)
if: contains(github.event.pull_request.labels.*.name, 'automerge')
uses: plm9606/[email protected]
with:
github-token: ${{ secrets.WORKFLOW_TOKEN }}
label-name: "automerge"
merge-method: "squash"
auto-delete: "true"
- name: Auto Merge (brain-score.org submissions)
if: contains(github.event.pull_request.labels.*.name, 'automerge-web')
uses: plm9606/[email protected]
with:
github-token: ${{ secrets.WORKFLOW_TOKEN }}
label-name: "automerge-web"
merge-method: "squash"
auto-delete: "true"