-
-
Notifications
You must be signed in to change notification settings - Fork 68
43 lines (38 loc) · 1.38 KB
/
renovate-automerge.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
name: Renovate AutoMerge
on:
pull_request:
jobs:
automerge:
if: contains(github.head_ref, 'renovate/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Analyze PR for Major Version Bump
id: analyze
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = context.payload.pull_request.body;
// Regex to find markdown table rows and check if any have 'major' in the Update column
const regex = /(?<=\|\s\[)(?:[^\]]+\]\(https?:\/\/[^\s\)]+\)\s\|\s)(major)(?=\s\|)/gi;
const isMajorUpdate = regex.test(body);
if (isMajorUpdate) {
console.log("Found a major version bump.");
core.setOutput("automerge", "false");
} else {
console.log("No major version bump found.");
core.setOutput("automerge", "true");
}
- name: Add automerge label
if: steps.analyze.outputs.automerge == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["automerge"]
})