-
I have a workflow triggered as follows:
I expect that after the stage deploy (which also runs API tests) completes successfully, then the production deploy would start. However, I just watched a failed stage deploy (which skipped its API tests due to the failed deploy) also trigger a production deploy. Is there a different “types” value for workflow_run that causes it not to fire if the workflow failed, rather than completed successfully? |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments 2 replies
-
Currently, there are only the two types requested and completed for the workflow_run event. As a workaround, you can use the expression “github.event.workflow_run.conclusion” to get the result of the previous workflow run, and use the job 's if conditional to skip all the job in the current workflow run when the previous workflow run is not success.
Of course, you also can directly report a feature request that add more types for the workflow_run event (such as success and failure) here. |
Beta Was this translation helpful? Give feedback.
-
how do you use
|
Beta Was this translation helpful? Give feedback.
-
@edudepetris I assume that both CI and Linters both trigger separate
If I’m right, then it might not be possible to wait for both parent workflows to succeed and then run the production deployment, unless you let Linters trigger CI and then let CI trigger Production deploy… |
Beta Was this translation helpful? Give feedback.
-
@brightran your suggestion works great, however, it is not documented in the webhook events docs: https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run I wonder if this property is authoritative, or will be removed in the future? |
Beta Was this translation helpful? Give feedback.
-
How was this ever considered useful or fit for production use in it’s current form? The workaround, aside from being ugly and error prone, still results in the workflow being triggered so you end up with hundreds of skipped runs when you look at the UI |
Beta Was this translation helpful? Give feedback.
-
this was frustrating me enough that I went ahead and created a new Action to deal with the shortcomings of The example
However by itself, this doesn’t quite work as expected.
All this makes the ahmadnassri/action-workflow-run-waitwait for all `workflow_run` required workflows to be successful |
Beta Was this translation helpful? Give feedback.
-
An alternative to conditionals on conclusion. github.comWorkflow run conclusion dispatch action - GitHub MarketplaceWorkflow run to repository dispatch. Event is `${workflowName} - ${conclusion}`, client_payload is the workflow run payload |
Beta Was this translation helpful? Give feedback.
-
how to handle the case where the workflow having multiple triggers - workflow_run and workflow_dispatch? what will be the default value of workflow_run.conclusion then? |
Beta Was this translation helpful? Give feedback.
-
did you happen to get |
Beta Was this translation helpful? Give feedback.
-
Yes it's working but jobs executed by |
Beta Was this translation helpful? Give feedback.
-
This is a good feature request however. To add |
Beta Was this translation helpful? Give feedback.
-
Why can you not have a standard dependency tree in which I have two workflows using two different computes that need to run in a separate workflow? Love what @pantelis-karamolegkos is saying here as well make a lot of sense. why can we not have this wait till they are both complete or both successful I agree that that seems very odd but the need to have two jobs for example a docker image being built and the terraform resources are completed prior to executing this job rather than it defaulting to execute two jobs. Sure can I look into GitHub check the history and if within the last 5 minutes it ran don't continue but why would that be something a user would need to do |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a link to submit a feature request to add the types |
Beta Was this translation helpful? Give feedback.
-
success and error status types for all acting events (even push or merge, so you can run something if a push was rejected or a merge failed) And, the best case scenario would be, inheritance (or import, however you want to call it) would be the best route. Import/inheritance should only be allowed from that local repository for security. Say you have a bunch of actions that require you to checkout, set up python, set up node, yarn, poetry , and buildx/docker/qemu in some others, you should be able to do: A special key like "inherits" or "import-jobs" or even *uses" at the job or steps level, with the format "
env: |
IMAGE_TAG: ${{import("docker.env.IMAGE_TAG")
jobs:
strategy:
matrix:
os: ${{ import("docker.jobs.matrix.os")}}
setup:
runs-on: ubuntu-latest
steps:
- run: |
echo "hello world"
- uses: [ "environment.jobs.environment.steps.devops", "linter.jobs.linting.steps.flake8" ]
- run: |
echo "All environment jobs and then linter jobs just ran in order, stopping execution if fail-fast is set in the matrix"
qemu:
- run: |
echo "set up qemu"
- uses: "docker.jobs.qemu"
import-jobs: [ "docker.jobs.buldx", "build.jobs", "release.jobs.upload.steps.push" ] # import the entire buildx job from the docker workflow and run it as a job here, and then do the same with all of the jobs from the build workflow, and then just the push step from upload job in the release workflow - in the order they are specified (can also just be a string and just run one)
finish:
- run: |
echo "all done" This sort of flexibility would make GitHub actions the most comprehensive and feature complete ci there is, and it would be the easiest to maintain your scripts and workflows because you D.R.Y Anyone know if I could contribute something like this to GitHub? Where? |
Beta Was this translation helpful? Give feedback.
@cuporter,
Currently, there are only the two types requested and completed for the workflow_run event.
As a workaround, you can use the expression “github.event.workflow_run.conclusion” to get the result of the previous workflow run, and use the job 's if conditional to skip all the job in the current workflow run when the previous workflow run is not success.
Of course, you…