generated from getumbrel/umbrel-community-app-store
-
-
Notifications
You must be signed in to change notification settings - Fork 11
91 lines (81 loc) · 2.95 KB
/
renovate-ci.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Renovate CI
on:
pull_request:
jobs:
get-last-commit-message:
if: contains(github.head_ref, 'renovate/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Get last commit message
id: get-last-commit-message
run: |
echo "last_commit_message=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT
update-config:
needs: get-last-commit-message
if: "!contains(${{ needs.get-last-commit-message.outputs.last_commit_message }}, '[ready]')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # Fetch all history
- name: Get changed files
uses: jitterbit/get-changed-files@v1
id: files
- name: Apply config update
run: |
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ $changed_file == "umbrel-app.yml" ]]; then
app_name=$(echo $changed_file | cut -d'/' -f 2)
echo "App name: $app_name"
# Assume the script updates the version automatically
./.github/workflows/update-umbrel-version.sh $app_name
fi
done
- name: Commit and push changes
uses: EndBug/add-and-commit@v9
with:
author_name: Big Bear CI
author_email: [email protected]
message: "Update app version [ready]"
commit: --no-verify
push: origin HEAD:${{ github.head_ref }}
automerge:
needs:
- update-config
- get-last-commit-message
if: contains(${{ needs.get-last-commit-message.outputs.last_commit_message }}, '[ready]')
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"]
})