Workflow not run for action-initiated push to PR using personal access token #25172
-
In my repo I have two actions: one for running tests and one for generating and committing documentation. The triggers for these are defined as:
and
Now when I push a change to a PR branch, both of these kick off. The docs are generated and committed + pushed back to the branch within ~30 seconds (if there are any documentation changes). The tests take a lot longer, 5+ minutes is not uncommon. Since the documentation is pushed to the PR branch using a personal access token, I was under the impression that this should trigger a _new _round of workflows, but it seems the push done by the docs action never triggers anything. The result is that the checks for the test workflow on the PR display as “Expected — Waiting for status to be reported”. When I look at the actions tab, I can see that the workflows were run for the first (human-initiated) push, but not for the second (action-initiated). What am I doing wrong here? Does the fact that the tests workflow is still running when the second push is done make a difference? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
@hihaj Could you please share your yml content of the workflow which named “Generate docs” here? Do you want to trigger the test workflow by pull_request event or push event when action-initiated push happened? >>Since the documentation is pushed to the PR branch using a personal access token. I tested in my side, I have a PR from yan0320 branch to master branch, and I have a workflow to push changes to yan0320 in an action.
With personal access token, after this action-initiated push, new workflows with on:pull_request is triggered . As in my workflow, there always have changes to push to yan0320, it makes this “Generate docs” workflow be triggered in loop. Please share us your scenario and expacted behavior in detail. |
Beta Was this translation helpful? Give feedback.
-
The expected behavior is this:
This is the “generate docs” workflow:
The only difference from your scenario @yanjingzhu is probably the run duration of my tests action? |
Beta Was this translation helpful? Give feedback.
-
@hihaj The difference from your scenario and mine is the checkout action version. You are using actions/checkout@v2 . Checkout action uses the default ${{ github.token }} as the credential, and git client will persist credentials in default. You need to add persist-credentials to false. And then when you push changes, git client will use your PAT instead of github.token.
Using PAT to push changes could trigger a new workflow. Please try it and let me know your result. |
Beta Was this translation helpful? Give feedback.
-
It works! Super! Big thanks! |
Beta Was this translation helpful? Give feedback.
@hihaj The difference from your scenario and mine is the checkout action version. You are using actions/checkout@v2 . Checkout action uses the default ${{ github.token }} as the credential, and git client will persist credentials in default.
You need to add persist-credentials to false. And then when you push changes, git client will use your PAT instead of github.token.
Using PAT to push changes could trigger a new workflow. Please try it and let me know your result.