-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip using paths_filter: pre job logs it will skip target jobs but target jobs still run #326
Comments
Any news? I get global should_skip = true and |
I apologize for the late answer. If you run into problems with the paths_filter option, then I would recommend to copy the example 1 multiple times according to your needs: https://github.com/fkirc/skip-duplicate-actions#example-1-skip-entire-jobs With the example 1, there is no need for any JSON-parsing, instead you can check the global should_skip output. |
I am closing this issue because of PR https://github.com/fkirc/skip-duplicate-actions/pull/336/files , please re-open if needed |
@fkirc but is it a bug or expected behaviour? |
Happy to take a look at it if you can provide some logs 👍 |
I had the exact same issue as above. Now I'm using 2 steps without paths_filter as a workaround. |
Let‘ reopen the issue because my proposed solution seems to be only a workaround |
@fkirc after a lot of testing, I can confirm that the You should consider the following very relevant statement from the docs when developing a workflow with conditions:
Since I was not aware of this, I got different results than expected when testing the workflow, e.g. if a What I noticed, that there are two issues with the docs: Workflow syntaxExample 3 does not use expression syntax: if: needs.pre_job.outputs.should_skip != 'true' && !fromJSON(needs.pre_job.outputs.paths_result).frontend.should_skip I'm not 100% sure if this is an issue but following the GitHub docs on workflow-syntax-for-github-actions, I was able to get the skip-check working:
Updated code: if: ${{ needs.pre_job.outputs.should_skip != 'true' && !fromJSON(needs.pre_job.outputs.paths_result).frontend.should_skip }} How to Use Skip Check With Required Matrix Jobs?When trying to combine the Example code 3 The final and only required check should only fail if the result of a preceding job is What helped me getting my final required I hope this helps someone, since I spent much time in investigating. You can find my full build-workflow here. # This job is the final job that runs after all other jobs and is used for branch protection status checks.
# See: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks
# https://github.com/orgs/community/discussions/26822#discussioncomment-5122101
build-result:
name: Build Result
needs: [pre_job, core, react, vue, laravel]
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
actions: read
steps:
- name: Debug build result
run: |
echo "pre_job_result: ${{ needs.pre_job.outputs.should_skip }}"
echo "core_job_result: ${{ needs.core.result }}"
echo "react_job_result: ${{ needs.react.result }}"
echo "vue_job_result: ${{ needs.vue.result }}"
echo "laravel_job_result: ${{ needs.laravel.result }}"
- name: Check status of all precursor jobs
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1 |
I am following Example 3 from the README, but I am struggling to get jobs actually skipped. I am in a monorepo and want to do exactly as the documented example suggests: only run frontend checks when frontend files are updated and only run backend checks when backend files are updated.
In my GitHub Branches settings I have the three status checks (pre, api, and ui) marked as required.
I put up a test PR that contained a change to a file in neither the frontend nor the backend, so I expected both checks to be skipped and the status checks to pass. In the Actions log, the pre job is logging that it is going to skip both checks, as expected. However, I can see from the Action logs that both steps do in fact continue to run - why is this? How can I skip them?
![image](./?url=aHR0cHM6Ly91c2VyLWltYWdlcy5naXRodWJ1c2VyY29udGVudC5jb20vODg0NTI3My8yMjIwNTMxMTktOWYxNTIyN2ItYjMyZC00OGFlLWIzNjAtZjM2NThiNzI4MmMyLnBuZw==&__proxy_form=0)
![image](./?url=aHR0cHM6Ly91c2VyLWltYWdlcy5naXRodWJ1c2VyY29udGVudC5jb20vODg0NTI3My8yMjIwNTMxOTAtZmRjOThhNDAtMTJjMi00YjY1LWE5NDctOWJiMDc3MTBiZDZkLnBuZw==&__proxy_form=0)
![image](./?url=aHR0cHM6Ly91c2VyLWltYWdlcy5naXRodWJ1c2VyY29udGVudC5jb20vODg0NTI3My8yMjIwNTMyMzItNjRmOWQ4NzMtZGEwYi00Nzk3LTlmOGUtNjIzMDdlOGEwYjRmLnBuZw==&__proxy_form=0)
pre job log:
api job log:
ui job log:
The workflow file:
I tried removing the global should_skip check from the api and ui jobs, but then no checks at all ran (not even the pre check) which put me back to the original problem.
The text was updated successfully, but these errors were encountered: