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

Remove work around for triggering branch checks #70

Merged
merged 5 commits into from
Jan 8, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 17 additions & 11 deletions README.md
Expand Up @@ -10,7 +10,7 @@ After installation simply comment `/rebase` to trigger the action:

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

```yml
```yaml
on:
issue_comment:
types: [created]
Expand All @@ -24,26 +24,32 @@ jobs:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
fetch-depth: 0
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo,
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token.
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

## Restricting who can call the action

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`.
> NOTE: To ensure branch checks run use a [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
jackton1 marked this conversation as resolved.
Show resolved Hide resolved

# Running multiple GitHub Actions workflows
Example

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.
```yaml

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:
```
on: [push, pull_request_review]
...
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.4
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
```
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).



## Restricting who can call the action

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`.

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.
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*.
Expand Down