Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: Lint
name: Lint & Test
on:
pull_request:
merge_group:
workflow_dispatch:

jobs:
lint:
lint-and-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
show-progress: false

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version-file: .node-version
cache: npm

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Test
run: npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.npmrc
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.6.0
24
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
</p>
<h1 align="center">🦥 Sloth 🦥</h1>

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

## When to Use Sloth

Sloth is invaluable in the following scenarios:

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

## Configuration

Expand All @@ -38,7 +38,7 @@ permissions:

jobs:
sloth:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Sloth
uses: lendable/sloth@v0
Expand All @@ -49,10 +49,31 @@ jobs:
## Inputs

| Name | Description | Required | Default |
|------------|----------------------------------------------------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------|
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------- |
| `token` | GitHub token to use to interact with the GitHub API, unless you have rate limit concerns this should be `${{ secrets.GITHUB_TOKEN }}`. | Yes | |
| `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 }}` |
| `interval` | The number of seconds in between polls of the GitHub API for check run conclusions. | No | `10` |
| `timeout` | The number of seconds before the job is declared a failure if check runs have not yet concluded. | No | `600` |
| `name` | The name of Sloth's own check run. This is used to ensure Sloth does not wait upon itself. | No | `"sloth"` |
| `ignored` | A multi-line list of check run names to ignore when determining an overall result. | No | `""` |
| `ignored` | A multi-line list of check run names or glob patterns to ignore when determining an overall result. Supports `*` wildcard. | No | `""` |

## Ignoring Checks

The `ignored` input 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
```

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.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ inputs:
required: false
default: "sloth"
ignored:
description: "A multi-line list of check run names to ignore when determining an overall result."
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')."
required: false
default: ""
runs:
using: node20
using: node24
main: dist/index.js
102 changes: 86 additions & 16 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading
Loading