Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 6cfc342

Browse files
jackton1fkorotkov
andauthored
Remove work around for triggering branch checks (#70)
* Remove work around for triggering branch checks Fixes bug triggering branch checks after running rebase action. * Update README.md * Update README.md * Update README.md * Update README.md Co-authored-by: Fedor Korotkov <[email protected]> Co-authored-by: Fedor Korotkov <[email protected]>
1 parent 7e3fc92 commit 6cfc342

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,51 @@ After installation simply comment `/rebase` to trigger the action:
1010

1111
To configure the action simply add the following lines to your `.github/workflows/rebase.yml` workflow file:
1212

13-
```yml
14-
on:
13+
```yaml
14+
name: Automatic Rebase
15+
on:
1516
issue_comment:
1617
types: [created]
17-
name: Automatic Rebase
1818
jobs:
1919
rebase:
2020
name: Rebase
2121
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
2222
runs-on: ubuntu-latest
2323
steps:
24+
- name: Checkout the latest code
25+
uses: actions/checkout@v2
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
29+
- name: Automatic Rebase
30+
uses: cirrus-actions/[email protected]
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
```
34+
35+
> NOTE: To ensure GitHub Actions will be automatically re-run after a successful rebase action use a workaround of using a [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token). See the following [discussion](https://github.community/t/triggering-a-new-workflow-from-another-workflow/16250/37) for more details.
36+
37+
Example
38+
39+
```yaml
40+
41+
...
2442
- name: Checkout the latest code
2543
uses: actions/checkout@v2
2644
with:
27-
fetch-depth: 0
45+
token: ${{ secrets.PAT_TOKEN }}
46+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
2847
- name: Automatic Rebase
2948
uses: cirrus-actions/[email protected]
3049
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
3251
```
3352
34-
## Restricting who can call the action
3553
36-
It's possible to use `author_association` field of a comment to restrict who can call the action and skip the rebase for others. Simply add the following expression to the `if` statement in your workflow file: `github.event.comment.author_association == 'MEMBER'`. See [documentation](https://developer.github.com/v4/enum/commentauthorassociation/) for a list of all available values of `author_association`.
37-
38-
# Running multiple GitHub Actions workflows
3954
40-
If you have another workflow setup that for example executes unit tests, and that workflow is a required status check that needs to pass before merging, you may find the check in "waiting" status after `/rebase`. Unfortunately, that's a current Actions limitation, see [this community post](https://github.community/t/triggering-a-new-workflow-from-another-workflow/16250/33) and/or [#65](https://github.com/cirrus-actions/rebase/issues/65) for more details.
55+
## Restricting who can call the action
4156
42-
However, one possible workaround is to setup your test workflow to run also on [pull request review events](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#pull_request_review) like:
43-
```
44-
on: [push, pull_request_review]
45-
```
46-
Then for example approving a code review will start, run and finish the test workflow and you'll be able to merge the pull request (if the check passes).
57+
It's possible to use `author_association` field of a comment to restrict who can call the action and skip the rebase for others. Simply add the following expression to the `if` statement in your workflow file: `github.event.comment.author_association == 'MEMBER'`. See [documentation](https://developer.github.com/v4/enum/commentauthorassociation/) for a list of all available values of `author_association`.
4758

4859
GitHub can also optionally dismiss an existing review automatically after rebase, so you'll need to re-approve again which will trigger the test workflow.
4960
Set it up in your repository *Settings* > *Branches* > *Branch protection rules* > *Require pull request reviews before merging* > *Dismiss stale pull request approvals when new commits are pushed*.
50-

0 commit comments

Comments
 (0)