Skip to content

Commit c7cd056

Browse files
Automatically label PRs to sync by default (#822)
1 parent b04ac77 commit c7cd056

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/pr-auto-label.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Automatically mark PRs to sync"
2+
3+
on:
4+
pull_request_target:
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
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PR_URL: ${{ github.event.pull_request.html_url }}
21+
22+
- name: Comment on PR to explain sync label
23+
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."
24+
env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
PR_URL: ${{ github.event.pull_request.html_url }}

.github/workflows/pr-auto-merge.yml

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 }}

0 commit comments

Comments
 (0)