Not require dependent Job to run #26793
-
I have the following: How do I:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You could try this:
|
Beta Was this translation helpful? Give feedback.
-
@dkirrane You cannot use the env context in job if, which make me to believe you are using nektos/act. For github some infomation ( this won’t apply to act, it acts differently ) about the status functions
Job-level "if" condition not evaluated correctly if job in "needs" property is skipped
**Describe the bug** If a job `needs` a prior job which has been skipped, the `…if` condition for the dependent job may behave unexpectedly under some conditions. (unsure if condition is evaluated incorrectly or if it's not evaluated at all) To Reproduce on: push
jobs:
job_a:
runs-on: ubuntu-latest
outputs:
truthy_string: ${{ steps.a.outputs.always }}
null_value: ${{ steps.b.outputs.never }}
steps:
- id: a
run: echo "::set-output name=always::something"
- id: b
run: echo "We opt not to set any output at this time"
job_b:
runs-on: ubuntu-latest
needs: job_a
if: needs.job_a.outputs.null_value
steps:
- run: echo "We've ensured this job will be skipped"
job_c:
runs-on: ubuntu-latest
needs: [job_a, job_b]
if: needs.job_a.outputs.truthy_string
steps:
- run: echo "This won't run, even though the IF condition evaluates true."
job_d:
runs-on: ubuntu-latest
needs: [job_a, job_b]
if: always() && needs.job_a.outputs.truthy_string
steps:
- run: echo "This will run, even though we've only changed the condition from `true` to `true && true`" Examining the output of this workflow, job_a will always run, job_b will always be skipped, job_c will always be skipped, and job_d will run. Expected behavior OR documentation should be updated to indicate this is expected behavior. The current docks simply says of job Runner Version and PlatformVersion of your runner? OS of the machine running the runner? OSX/Windows/Linux/... What's not working?Jobs are being skipped even when the job-level conditional evaluates to Job Log OutputBecause the job is skipped entirely, there is no job-level output, even if the appropriate DEBUG secret is set. Runner and Worker's Diagnostic LogsAs above, there is no additional output, even if the appropriate DEBUG secret is set. Add this condition to job3 to run it even when dependent jobs are skipped, also not applies to act I suggest to replace act with GitHub - ChristopherHX/runner.server: An unofficial Console Client and Server for GitHub Action Runners it isn’t as far away from github as act. |
Beta Was this translation helpful? Give feedback.
@dkirrane
You have a syntax error in your workflow or does github actions allow it now?
You cannot use the env context in job if, which make me to believe you are using nektos/act.
See Issue: GitHub Actions says workflow is not valid because of `${{ !env.ACT }}` · Issue #720 · nektos/act · GitHub
For github some infomation ( this won’t apply to act, it acts differently ) about the status functions
Job-level "if" condition not evaluated correctly if job in "needs" property is skipped