Skip to content

Commit d3e1c55

Browse files
Add workflows
1 parent 570867d commit d3e1c55

3 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Automatically mark PRs to sync"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
8+
jobs:
9+
labeler:
10+
if: github.event.pull_request.user.type != 'Bot'
11+
permissions:
12+
pull-requests: write
13+
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Add "sync" label to PR
17+
run: gh pr edit "$PR_URL" --add-label sync --repo "$PR_REPO"
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PR_URL: ${{ github.event.pull_request.html_url }}
21+
PR_REPO: ${{ github.repository }}
22+
23+
- name: Comment on PR to explain sync label
24+
run: gh pr comment "$PR_URL" --body "This pull request has been marked to **automatically sync** to its base branch. You can **disable** this behavior by removing the `sync` label." --repo "$PR_REPO"
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
PR_URL: ${{ github.event.pull_request.html_url }}
28+
PR_REPO: ${{ github.repository }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Automatically enable auto-merge on PRs"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- ready_for_review
8+
branches:
9+
- main
10+
11+
jobs:
12+
enable-automerge:
13+
if: github.event.pull_request.draft == false
14+
permissions:
15+
pull-requests: write
16+
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Enable auto-merge for the PR
20+
run: gh pr merge "$PR_URL" --auto --squash
21+
env:
22+
GH_TOKEN: ${{ secrets.PR_AUTO_UPDATE_TOKEN }}
23+
PR_URL: ${{ github.event.pull_request.html_url }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: pr-auto-update
2+
on:
3+
push: {}
4+
5+
jobs:
6+
pr-auto-update:
7+
name: Automatic PR Updater
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
contents: write
12+
steps:
13+
- name: Generate Access Token
14+
uses: actions/create-github-app-token@v2
15+
id: generate-token
16+
with:
17+
app-id: ${{ vars.PR_AUTO_UPDATE_CLIENT_ID }}
18+
private-key: ${{ secrets.PR_AUTO_UPDATE_PRIVATE_KEY }}
19+
20+
- uses: CSSUoB/pr-auto-updater@v2.3.1
21+
env:
22+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
23+
PR_FILTER: 'labelled'
24+
PR_LABELS: 'sync'
25+
MERGE_CONFLICT_ACTION: 'label'
26+
MERGE_CONFLICT_LABEL: 'conflict'

0 commit comments

Comments
 (0)