rebase
rebase copied to clipboard
Rebase command can not trigger test check workflow
the RP after rebase by /rebase command can not trigger test check workflow
+1 I tryied to pass a custom token, but nothing changed... my test workflows don't fire.
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_API_TOKEN }}
+1
This is a weird Actions limitation that one workflow can't trigger another one. See this community post for more details. I don't believe there is a viable workaround at the moment. On a bright side it does work with 3rdparty CIs like Travis, Circle and Cirrus.
I tried adding
on:
workflow_run:
workflows: ["Automatic Rebase"]
types:
- completed
to test workflow, it is run on default branch not within context of rebased pull request.
Documentation seemed promising
This event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow. For example, if your pull_request workflow generates build artifacts, you can create a new workflow that uses workflow_run to analyze the results and add a comment to the original pull request.
https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_run
But article about this feature clearly states that
Runs triggered by the workflow_run event always use the default branch for the repository
https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/
This is a weird Actions limitation that one workflow can't trigger another one. See this community post for more details. I don't believe there is a viable workaround at the moment. On a bright side it does work with 3rdparty CIs like Travis, Circle and Cirrus.
this action https://github.com/Label305/AutoRebase can auto rebase and trigger CI workflow by use a personal github token.
I try to use a personal github token for cirrus-actions/rebase, but not work.
I've worked around the issue by letting my GitHub Actions test workflow run also on pull request review events:
on: [push, pull_request_review]
Running /rebase will rebase the branch but the PR will be stuck waiting for the test workflow to finish but it doesn't even start (that's this issue). Approving a review will start it and run it again and then the test workflow finishes 🎉
GitHub can also optionally dismiss an existing review automatically prompting someone to approve the change again triggering the test workflow.
Not perfect but it works for me. Thank you for this rebase action 👍
I've now created a PR with that workaround description because maybe more people might find it useful.
Do you think this will be fixed anytime soon by the GHA team?
@walterholohan Fixed here https://github.com/cirrus-actions/rebase/pull/70
@jackton1 I updated the action yaml file to
on:
issue_comment:
types: [created]
name: Automatic Rebase
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, you will fail 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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
where secrets.GH_PAT is a PAT that I have setup. However this did not solve the issue. After a successful rebase by thecirrus-actions/[email protected] action it did not trigger a new check workflow. Am I missing something from the above snippet?
@walterholohan it seems actions/checkout@v2 fails with the default github.token
Update
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
@jackton1 ive changed to the above suggestion but still no luck. The rebase completed successfully but the actions did not get triggered. Does the PAT need certain permissions? Maybe its missing something.
@walterholohan Try again using

Note for workflows that modify github actions you can enable

Thank you, It was an issue on my end. I was trying to test this out in a PR but when I triggered a rebase by adding a /rebase comment it what using the workflow from the develop branch instead of the PR. Once I merged the PR it worked. I also added persist-credentials: false to the checkout action