How to make one workflow dependent on the other? #26907
-
I am operating on the following two workflows -
I would want to make Here’s my repository (along with the desired branch): https://github.com/sayakpaul/wine/tree/experiment-1/. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
Hi @sayakpaul, It’s not supported to set Typically there are two methods to set ‘dependence’:
Doc here: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
Doc here: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run The limitation is you cannot get the pull request number in both methods( ${{ github.event.number }}). Instead, you can get all pull request of the repo via rest api, parse the pull request whose head ref is your branch to get the pull request number. Thanks |
Beta Was this translation helpful? Give feedback.
-
Thanks, @weide-zhou. The problem I am facing is that the The commit message one is the latest while the commented one is the older one. Any ways to solve this other than making the workflows independent? |
Beta Was this translation helpful? Give feedback.
-
Hi @sayakpaul, So the problem is how to make sure the 2nd workflow get the latest run.txt url.
Now you get the PR number and new URL, you can use them to add PR comment. It works on my side, please check my workflow for your reference. Note: This works when one pull request from head branch, if you have mutiple PRs, you can get a list of pull request number, and use a loop to add PR comment. Thanks Edited: fixed env code, and provide a sample workflow. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the detailed explanation. I tried adapting your workflow (see here) but the |
Beta Was this translation helpful? Give feedback.
-
Hi @sayakpaul, I notice the body is empty in your ‘PR-Comment’ job (value of
Thanks |
Beta Was this translation helpful? Give feedback.
-
@weide-zhou tried that but still no luck. Workflow file here. Workflow output here. |
Beta Was this translation helpful? Give feedback.
-
Hi @sayakpaul, The Please remove
Thanks. |
Beta Was this translation helpful? Give feedback.
-
I see. I just tried your fix. It works seamlessly now :slight_smile: |
Beta Was this translation helpful? Give feedback.
Hi @sayakpaul,
So the problem is how to make sure the 2nd workflow get the latest run.txt url.
Since it’s not supported to depend pull request event on push event, you can use two jobs as a workaround(not ideal but should work).