Description
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?
pre job log:
api job log:
ui job log:
The workflow file:
name: Format, compile, and lint
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
pre:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
paths_filter: |
api:
paths_ignore:
- 'api/api/migrations/**'
paths:
- 'api/**/*.py'
ui:
paths:
- 'ui/src/**/*.[jt]sx?'
api:
needs: pre
if: needs.pre.outputs.should_skip != 'true' || !fromJSON(needs.pre.outputs.paths_result).api.should_skip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: '--check --color --diff --extend-exclude api/api/migrations --verbose'
src: './api'
version: '22.12.0'
- uses: actions/setup-python@v4
with:
python-version: '3.8.13'
- uses: py-actions/flake8@v2
with:
args: '--extend-ignore=E203'
exclude: 'api/api/migrations'
flake8-version: '6.0.0'
max-line-length: '88'
ui:
needs: pre
if: needs.pre.outputs.should_skip != 'true' || !fromJSON(needs.pre.outputs.paths_result).ui.should_skip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Compile, lint, and format
run: |
cd ui
yarn
yarn generate-env-file
yarn tsc
npx eslint .
yarn prettier .
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.