Skip to content

Commit 7428b53

Browse files
authored
feat!: enhance ignored checks to support wildcard patterns (#128)
## Overview Enhance `ignored` option to support ignoring different check jobs based on wildcard patterns, where some specific dynamic jobs might need to be ignored where others don't. ## Changes The `ignored` input now accepts both exact check run names and glob patterns using the `*` wildcard. Each line is treated as a separate entry. **Exact match** — ignores a check with that precise name: ```yaml ignored: | some-optional-check ``` **Wildcard patterns** — `*` matches any sequence of characters: ```yaml ignored: | deploy-*-staging e2e / * / smoke-test ``` The default node version has been bumped to node 24.
1 parent cd21c5c commit 7428b53

17 files changed

Lines changed: 2033 additions & 257 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
name: Lint
1+
name: Lint & Test
22
on:
33
pull_request:
44
merge_group:
55
workflow_dispatch:
66

77
jobs:
8-
lint:
8+
lint-and-test:
99
runs-on: ubuntu-24.04
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1313
with:
1414
show-progress: false
15+
1516
- name: Setup Node.js
16-
id: setup-node
1717
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
1818
with:
1919
node-version-file: .node-version
2020
cache: npm
2121

2222
- name: Install dependencies
2323
run: npm ci
24+
2425
- name: Lint
2526
run: npm run lint
27+
28+
- name: Test
29+
run: npm test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
.npmrc

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.6.0
1+
24

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
</p>
44
<h1 align="center">🦥 Sloth 🦥</h1>
55

6-
Sloth is a GitHub Action designed to optimize and streamline continuous integration suites by acting as the final arbiter for their success.
7-
It patiently waits for all other checks to conclude, providing its seal of approval only if all triggered jobs were successful.
6+
Sloth is a GitHub Action designed to optimize and streamline continuous integration suites by acting as the final arbiter for their success.
7+
It patiently waits for all other checks to conclude, providing its seal of approval only if all triggered jobs were successful.
88
Sloth bridges a functionality gap within GitHub Actions, allowing for required checks to be dynamic, a feature not natively supported.
99

1010
## When to Use Sloth
1111

1212
Sloth is invaluable in the following scenarios:
1313

14-
* **Conditional Triggers with Mandatory Success**: Sloth is invaluable when you need to trigger a check conditionally, but mandate its success if triggered. For instance:
15-
* Linting GitHub Action workflows selectively when they are modified.
16-
* Running checks only for services modified within a monorepo.
17-
* **Large Matrix of Checks**: Sloth simplifies the management of extensive check matrices, alleviating the burden of maintaining which checks are required.
14+
- **Conditional Triggers with Mandatory Success**: Sloth is invaluable when you need to trigger a check conditionally, but mandate its success if triggered. For instance:
15+
- Linting GitHub Action workflows selectively when they are modified.
16+
- Running checks only for services modified within a monorepo.
17+
- **Large Matrix of Checks**: Sloth simplifies the management of extensive check matrices, alleviating the burden of maintaining which checks are required.
1818

1919
## Configuration
2020

@@ -38,7 +38,7 @@ permissions:
3838

3939
jobs:
4040
sloth:
41-
runs-on: ubuntu-22.04
41+
runs-on: ubuntu-24.04
4242
steps:
4343
- name: Sloth
4444
uses: lendable/sloth@v0
@@ -49,10 +49,31 @@ jobs:
4949
## Inputs
5050
5151
| Name | Description | Required | Default |
52-
|------------|----------------------------------------------------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------|
52+
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------- |
5353
| `token` | GitHub token to use to interact with the GitHub API, unless you have rate limit concerns this should be `${{ secrets.GITHUB_TOKEN }}`. | Yes | |
5454
| `ref` | Git reference to inspect check runs for. The default supports Pull Requests, Merge Queues as well as branch pushes. | No | `${{ github.event.pull_request.head.sha \|\| github.sha }}` |
5555
| `interval` | The number of seconds in between polls of the GitHub API for check run conclusions. | No | `10` |
5656
| `timeout` | The number of seconds before the job is declared a failure if check runs have not yet concluded. | No | `600` |
5757
| `name` | The name of Sloth's own check run. This is used to ensure Sloth does not wait upon itself. | No | `"sloth"` |
58-
| `ignored` | A multi-line list of check run names to ignore when determining an overall result. | No | `""` |
58+
| `ignored` | A multi-line list of check run names or glob patterns to ignore when determining an overall result. Supports `*` wildcard. | No | `""` |
59+
60+
## Ignoring Checks
61+
62+
The `ignored` input accepts both exact check run names and glob patterns using the `*` wildcard. Each line is treated as a separate entry.
63+
64+
**Exact match** — ignores a check with that precise name:
65+
66+
```yaml
67+
ignored: |
68+
some-optional-check
69+
```
70+
71+
**Wildcard patterns** — `*` matches any sequence of characters:
72+
73+
```yaml
74+
ignored: |
75+
deploy-*-staging
76+
e2e / * / smoke-test
77+
```
78+
79+
This is particularly useful for dynamic matrix jobs where check run names are generated at runtime and cannot be enumerated upfront. For example, skipping optional deployment or smoke-test checks from a dynamic CI matrix while still gating on the required checks.

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ inputs:
2525
required: false
2626
default: "sloth"
2727
ignored:
28-
description: "A multi-line list of check run names to ignore when determining an overall result."
28+
description: "A multi-line list of check run names or glob patterns to ignore when determining an overall result. Use * as a wildcard to match any sequence of characters (e.g. 'deploy-*-staging')."
2929
required: false
3030
default: ""
3131
runs:
32-
using: node20
32+
using: node24
3333
main: dist/index.js

dist/index.js

Lines changed: 86 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)