Debug logs for the if condition of skipped jobs #20640
Replies: 6 comments 4 replies
-
My jobs are being mysteriously skipped even though I'm sure the I would like the UI to provide me some way to ascertain why the job was skipped. |
Beta Was this translation helpful? Give feedback.
-
I made an emulator for GitHub Actions, which shows you debug output of job level if conditions. Weird enough, you can get the debug logs of job if conditions in Azure Pipelines (The current GitHub Actions Service Runner is a fork of it from 2019). |
Beta Was this translation helpful? Give feedback.
-
I struggled with this for a few hours. Everything seemed like the
name: CI
on:
- push
- workflow_dispatch
jobs:
run-check:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.set-output.outputs.should_run }}
steps:
- name: Set job output
id: set-output
run: |
echo "should_run='true'" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: run-check
if: ${{ needs.run-check.outputs.should_run == 'true' }}
steps:
- uses: actions/checkout@v3
name: CI
on:
- push
- workflow_dispatch
jobs:
run-check:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.set-output.outputs.should_run }}
steps:
- name: Set job output
id: set-output
run: |
echo "should_run=true" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: run-check
if: ${{ needs.run-check.outputs.should_run == true }}
steps:
- uses: actions/checkout@v3
name: CI
on:
- push
- workflow_dispatch
jobs:
run-check:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.set-output.outputs.should_run }}
steps:
- name: Set job output
id: set-output
run: |
echo "should_run='true'" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: run-check
if: ${{ needs.run-check.outputs.should_run == true }}
steps:
- uses: actions/checkout@v3
name: CI
on:
- push
- workflow_dispatch
jobs:
run-check:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.set-output.outputs.should_run }}
steps:
- name: Set job output
id: set-output
run: |
echo "should_run=true" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: run-check
if: ${{ needs.run-check.outputs.should_run == 'true' }}
steps:
- uses: actions/checkout@v3 Making a copy of the skipped job without the test-debug:
runs-on: ubuntu-latest
needs: run-check
steps:
- uses: actions/checkout@v3
- run: |
echo "Check 'should_run'"
echo "${{ needs.run-check.outputs.should_run }}" Hopefully this helps someone running into a similar issue. I do agree that it would have made debugging this much easier if there was some sort of information in the web UI as to why a job is skipped. |
Beta Was this translation helpful? Give feedback.
-
I'm disappointed that this has not been prioritized by the GitHub Actions team when it's a feature Azure DevOps Pipelines had half a decade ago. On a daily basis my team receives requests from other engineers for help diagnosing why steps were skipped or workflows cancelled unexpectedly. |
Beta Was this translation helpful? Give feedback.
-
I think its really bad practice to require users to modify the actions with additional jobs just to debug why a job was skipped. It makes the process really slow since you now need to go through code review process, just to debug, and you may potentially break the action for other users in the process. Being able to see why a step was skipped directly when running the action would speed up development a lot. Especially since github actions can be complex and powerful, the debugging tools need to reflect that. |
Beta Was this translation helpful? Give feedback.
-
This is an essential feature. |
Beta Was this translation helpful? Give feedback.
-
Coming from:
When a job is skipped because it’s if condition is not met, it’s very difficult to debug why that happened. It would be valuable to be able to see debug logs for the evaluation of the job-level if condition.
It’s sometimes possible to work around this by creating another job without a conditional and then creating steps with the same if condition that is used at the job-level for another job (Example). However, it’s inconvenient and not safe to assume that the evaluation of a condition is going to be the same at the job and step level.
Furthermore, when using a callable workflow, the job in the caller workflow will be skipped if none of the if conditions are met for the jobs inside the callable workflow, which was difficult to figure out. Maybe the UI could be altered to make this more clear, but the debug logs would have really helped.
Thanks! Curious to hear people’s thoughts.
Beta Was this translation helpful? Give feedback.
All reactions