CARVIEW |
Navigation Menu
Push from Action does not trigger subsequent action #25702
-
I have an github action which sometimes pushes back to the repository, and I expect this push to trigger another action which configured with βon: pushβ, however this seems to not work. Is this intentional? Sample repository to demonstate the issue:Β https://github.com/Stummi/workflow-playground/tree/master/.github/workflows |
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 20 comments · 16 replies
-
Hi Stummi, Glad to hear you in GitHub Community! If an action pushes code using the repositoryβs GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur. Please create a personal access token in repo setting(write permission accordingly), replace GITHUB_TOKEN in your βinc-counter.ymlβ, code as below, thanks.
|
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1 -
π 21
-
Works well. However, I wish this arbitrary limitation on GITHUB_TOKEN was removed. |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 83
-
This limitation is significantly diminishing all the benefits that GITHUB_TOKEN brings. If I have to allocate a PAT to work around this limitation, then why would I use GITHUB_TOKEN in the first place? |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 46
-
RESOLVED: As another comment and push action doc say, need add - uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. ISSUE: Did I miss something? This action can't trigger another action which run when push. workflow file: name: Posts Sync
on:
workflow_dispatch:
jobs:
sync:
name: Posts Sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Update
run: |
git submodule update --remote content/posts
- name: Commit
run: |
git config --local user.name github-actions
git config --local user.email github-actions@github.com
git commit -am "Auto updated posts" || echo "No changes to commit"
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.HUGO_SITE_GIT_TOKEN }}
branch: ${{ github.ref }} |
Beta Was this translation helpful? Give feedback.
All reactions
-
Agreed. Imo the limitation on the GitHub token should be removed and those that don't want their pushes from GitHub actions to kick off workflows can go about it using the already existing commit message format to do so. |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 2
-
Apps (like Netlify) get triggered on pushes from actions using the |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 8
-
This helped. Thank you! |
Beta Was this translation helpful? Give feedback.
All reactions
-
Is there a plan for removing this limitation? Providing a personal access token grants the Action far greater privileges than it needs. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Iβm using this same workflow with a second one triggered on pull_request. Even if I use a PAT my pull_request workflow doesnβt run when commits are pushed back to the PR branch. This is an example of my workflowΒ https://gist.github.com/xt0rted/d0eac04e15a7cea80aa974a4448defef |
Beta Was this translation helpful? Give feedback.
All reactions
-
The comments at https://github.community/t5/GitHub-Actions/Push-from-action-even-with-PAT-does-not-trigger-action/m-p/46293/highlight/true#M6505Β solved my issue. I needed to add persist-credentials: false to my checkout step since itβs using v2. |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
This has been driving me CrAzY because itβs not intuitive and hard to find information about. Thank you for the workaround. |
Beta Was this translation helpful? Give feedback.
All reactions
-
it took me hours to find this post. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Shouldnβt adding one of these permissions (Workflow syntax for GitHub Actions - GitHub Docs) to the |
Beta Was this translation helpful? Give feedback.
All reactions
-
Does this work? |
Beta Was this translation helpful? Give feedback.
All reactions
-
It doesn't appear to work, even with |
Beta Was this translation helpful? Give feedback.
All reactions
-
You can set |
Beta Was this translation helpful? Give feedback.
All reactions
-
I know this is a fairly old discussion, but I think it'd be handy to be able to get a PAT for the user who initiated the action (for actions that are triggered via the workflow_dispatch event). Seems like this would provide a better audit trail than a static personal access token of like a "service account". |
Beta Was this translation helpful? Give feedback.
All reactions
-
I'm not sure my configuration is exactly the same as the accepted answer, but I just wanted to post that I created an multi-job workflow that bumped and committed a package.json version number and with concurrency rules, it canceled the current workflow and started up a new one. It did this 3 times until I manually stopped the workflow. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you, it took me several hours to find the issue~ |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
This is a big issue in our flow, I need to pull my trunk branch into feature branches in my CI/CD if there are changes there, but the pipeline doesn't get triggered because of this. There can be changes in my trunk branch which when merged into feature branch can fail the build, but the pipeline wont get triggered, also using PAT is not the best of options, I want to use default token rather than creating a token and making sure it doesn't expire, securing it, etc |
Beta Was this translation helpful? Give feedback.
All reactions
-
I have also spent some time debugging this issue. I think GitHub will not allow triggering such workflows to prevent building recursive triggering of actions. The workaround is to use a PAT with the fitting permissions. I have also found this in the documentation s.
s. https://docs.github.com/en/actions/security-guides/automatic-token-authentication |
Beta Was this translation helpful? Give feedback.
All reactions
-
They could use concurrency to limit. The same recursive issue would occur if we run manually Here is some inspiration for anyone wanting to abuse this |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 2
-
NB: for the
|
Beta Was this translation helpful? Give feedback.
All reactions
-
Github seems to be very thorough in not allowing us to re-run CI workflows:
Since Github will seemingly never listen to our requests, has anyone found an exploit to work around this, or has anyone tried any other designs to document what doesn't work? |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
i m having the same issue. In my use case, I want the workflow to amend commit and push -f. But once that done the check will never be triggered, |
Beta Was this translation helpful? Give feedback.
All reactions
-
As an alternative: If you want an action to run after another action, you can also use the Example
How I updated my actions |
Beta Was this translation helpful? Give feedback.
All reactions
-
The issue is that the workflow does not show up on the commit. This is a particular issue for PRs |
Beta Was this translation helpful? Give feedback.
All reactions
-
But if the commit is triggered by you as the actual user it should work? and if its triggered by an action you can make use of |
Beta Was this translation helpful? Give feedback.
All reactions
-
Look at your own repo:
The key is to try and achieve the following:
If you can achieve that with anithing |
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
I saw that, and you can do it with
This is the main point, because if you have a CI with a required workflow that must pass, you will never be able to make it pass after you make a commit. An example is running
|
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
I have stumbled on Here is one example of that workflow in the wild π |
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't consider this issue solved. Creating manual PATs for every repo is very tedious and not scalable. Surely a flag that overrides the default behavior to not trigger on_push workflows can't be unreasonably hard to add. |
Beta Was this translation helpful? Give feedback.
All reactions
-
I feel like there's something I'm missing here. I know |
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
I bet they are trying to avoid infinite loops in actions, still it's a very unexpected behavior. |
Beta Was this translation helpful? Give feedback.
Hi Stummi,
Glad to hear you in GitHub Community!
If an action pushes code using the repositoryβs GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.
Please create a personal access token in repo setting(write permission accordingly), replace GITHUB_TOKEN in your βinc-counter.ymlβ, code as below, thanks.