Skip to content

Commit 5bd4789

Browse files
authored
Update README.md
1 parent 26e7f29 commit 5bd4789

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,14 @@ Inspired by [Merge Queue feature of Mergify](https://mergify.io/features/merge-q
1414
1515
## Quick Start
1616

17-
1. Enable `Allow auto-merge` in `Settings/Options`.
18-
19-
2. (Optional) Create a branch protection rule in `Settings/Branches`.
20-
21-
Support checks:
17+
> This action only has effect if you enabled `Settings/Branches/YourBranchProtectionRule/Require status checks to pass before merging/Require branches to be up to date before merging`.
2218
23-
- `Require approvals`
24-
- `Status checks that are required`
25-
26-
This feature requires personal access token that has enough permission.
19+
1. Enable `Allow auto-merge` in `Settings/Options`.
2720

2821
3. Create a workflow file (`.github/workflow/update-branch.yaml`):
2922

23+
Example:
24+
3025
```yaml
3126
name: Update branch
3227

@@ -54,15 +49,32 @@ jobs:
5449
token: ${{ secrets.GITHUB_TOKEN }}
5550
# One of MERGE, SQUASH, REBASE (default: MERGE)
5651
autoMergeMethod: SQUASH
57-
# Required at least 2 approves (default: 0)
58-
requiredApprovals: 2
5952
# Ignore pull requests without these labels
6053
requiredLabels: auto-merge
54+
# Required at least 2 approves (default: 0)
55+
requiredApprovals: 2
6156
# Required these status checks success
6257
requiredStatusChecks: |
6358
build_pr
6459
WIP
65-
# Optional branch name pattern instead of main or master
66-
# Status checks will be used
67-
# protectedBranchNamePattern: trunk
60+
```
61+
62+
If you are using a personal access token and it has permission to access branch protection rules, you can set your jobs like:
63+
64+
```yaml
65+
jobs:
66+
update-branch:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: lcdsmao/update-branch@v3
70+
with:
71+
# Personal access token
72+
token: ${{ secrets.MY_PAT }}
73+
# One of MERGE, SQUASH, REBASE (default: MERGE)
74+
autoMergeMethod: SQUASH
75+
# Ignore pull requests without these labels
76+
requiredLabels: auto-merge
77+
# `Status checks` and `Require approvals` settings will be used
78+
# Or ignore this key then the action will automatically find main or master branch protection rule
79+
protectedBranchNamePattern: trunk
6880
```

0 commit comments

Comments
 (0)