CI: Convert paths-ignore into separate job that checks changed paths

We need to invoke the CI jobs every time, even if nothing relevant has
changed, because we marked them as required status checks for PRs. If
they are not invoked, the associated status checks remain in a 'pending'
state indefinitely not allowing us to (auto-)merge the PR.
This commit is contained in:
Jelle Raaijmakers
2024-12-12 11:30:04 +01:00
committed by Tim Flynn
parent 1b01464e41
commit 8ddd9ea5f4

View File

@@ -1,22 +1,40 @@
name: CI
on:
push:
paths-ignore:
- 'Documentation/**'
- '*.md'
pull_request:
paths-ignore:
- 'Documentation/**'
- '*.md'
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
cancel-in-progress: true
jobs:
# Look at changed paths in the commit or PR to determine whether we need to run the complete CI job. If only
# documentation or .md files were changed, we wouldn't need to compile and check anything here.
path-changes:
runs-on: ubuntu-24.04
permissions:
pull-requests: read
outputs:
source_excluding_docs: ${{ steps.filter.outputs.source_excluding_docs }}
steps:
# Only need a checkout if we're not running as part of a PR
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
# FIXME: change into `dorny/paths-filter@v3` when https://github.com/dorny/paths-filter/pull/226 is merged
- uses: petermetz/paths-filter@5ee2f5d4cf5d7bdd998a314a42da307e2ae1639d
id: filter
with:
predicate-quantifier: every # all globs below must match
filters: |
source_excluding_docs:
- '**'
- '!Documentation/**'
- '!*.md'
# CI matrix - runs the job in lagom-template.yml with different configurations.
Lagom:
if: github.repository == 'LadybirdBrowser/ladybird'
needs: path-changes
if: github.repository == 'LadybirdBrowser/ladybird' && needs.path-changes.outputs.source_excluding_docs == 'true'
strategy:
fail-fast: false