generated from getumbrel/umbrel-community-app-store
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto-merge workflows for pull requests
- Loading branch information
1 parent
cc24a87
commit dfd43f7
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: automerge | ||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
- unlabeled | ||
- synchronize | ||
- opened | ||
- edited | ||
- ready_for_review | ||
- reopened | ||
- unlocked | ||
pull_request_review: | ||
types: | ||
- submitted | ||
check_suite: | ||
types: | ||
- completed | ||
status: {} | ||
jobs: | ||
automerge: | ||
env: | ||
MERGE_METHOD: "squash" | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: automerge | ||
name: automerge | ||
uses: "pascalgn/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Renovate AutoMerge | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
automerge: | ||
if: contains(github.head_ref, 'renovate/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- 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"] | ||
}) |