Skip to content

Commit 5397667

Browse files
committed
ci: stop auto-merge on PR's with gthub_action updates
1 parent 94717f6 commit 5397667

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

.github/jsTemplates/workflows/automerge.yml.ts

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { defaultJobMachine, bot, JOB } from './constants';
22
import * as STEP from './steps';
33

4+
const disableMergeLabel = 'github_actions';
5+
46
export = {
57
name: 'automerge-dependabot',
68
on: {
@@ -11,10 +13,34 @@ export = {
1113
},
1214
},
1315
jobs: {
14-
'pre-automerge': JOB.proceedIfBot,
16+
'pre-automerge-bot': JOB.proceedIfBot,
17+
'pre-automerge-label': {
18+
needs: ['pre-automerge-bot'],
19+
if: `needs.pre-automerge-bot.outputs.status != 'success'`,
20+
outputs: {
21+
status: '${{ steps.check-label.conclusion }}',
22+
},
23+
...defaultJobMachine,
24+
steps: [
25+
{
26+
id: 'search-label',
27+
uses: 'Dreamcodeio/pr-has-label-action@v1.2',
28+
with: {
29+
label: disableMergeLabel,
30+
},
31+
},
32+
{
33+
name: `Check if label is ${disableMergeLabel}`,
34+
id: 'check-label',
35+
if: 'steps.search-label.outputs.hasLabel == true',
36+
run: `echo Skip! Pull request labelled ${disableMergeLabel}
37+
exit 0`,
38+
},
39+
],
40+
},
1541
'automerge-dependabot': {
16-
needs: ['pre-automerge'],
17-
if: `needs.pre-automerge.outputs.status != 'success'`,
42+
needs: ['pre-automerge-label'],
43+
if: `needs.pre-automerge-label.outputs.status != 'success'`,
1844
...defaultJobMachine,
1945
steps: [
2046
...STEP.waitForCheckName('commitlint'),
@@ -23,7 +49,7 @@ export = {
2349
...STEP.waitForCheckName('test (12.x)'),
2450
{
2551
name: 'Merge me!',
26-
uses: 'ridedott/merge-me-action@v1.3.12',
52+
uses: 'ridedott/merge-me-action@v1.3.13',
2753
with: {
2854
// eslint-disable-next-line @typescript-eslint/naming-convention
2955
GITHUB_LOGIN: bot,

.github/workflows/automerge.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ name: automerge-dependabot
2121
branches:
2222
- develop
2323
jobs:
24-
pre-automerge:
24+
pre-automerge-bot:
2525
outputs:
2626
status: '${{ steps.check-author.conclusion }}'
2727
runs-on: ubuntu-latest
@@ -32,10 +32,28 @@ jobs:
3232
run: |-
3333
echo Skip! Pull request created by ${{ github.event.pull_request.user.login }} not dependabot[bot]
3434
exit 0
35+
pre-automerge-label:
36+
needs:
37+
- pre-automerge-bot
38+
if: needs.pre-automerge-bot.outputs.status != 'success'
39+
outputs:
40+
status: '${{ steps.check-label.conclusion }}'
41+
runs-on: ubuntu-latest
42+
steps:
43+
- id: search-label
44+
uses: Dreamcodeio/pr-has-label-action@v1.2
45+
with:
46+
label: github_actions
47+
- name: Check if label is github_actions
48+
id: check-label
49+
if: steps.search-label.outputs.hasLabel == true
50+
run: |-
51+
echo Skip! Pull request labelled github_actions
52+
exit 0
3553
automerge-dependabot:
3654
needs:
37-
- pre-automerge
38-
if: needs.pre-automerge.outputs.status != 'success'
55+
- pre-automerge-label
56+
if: needs.pre-automerge-label.outputs.status != 'success'
3957
runs-on: ubuntu-latest
4058
steps:
4159
- name: Wait for commitlint

0 commit comments

Comments
 (0)