Skip to content

feat: add allow-empty option for path-filtered workflow support - #131

Merged
Mark Woolley (marknet15) merged 3 commits into
mainfrom
feat/allow-empty-check-runs
Apr 7, 2026
Merged

feat: add allow-empty option for path-filtered workflow support#131
Mark Woolley (marknet15) merged 3 commits into
mainfrom
feat/allow-empty-check-runs

Conversation

@marknet15

@marknet15 Mark Woolley (marknet15) commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds allow-empty input (default false) that lets Sloth succeed when no other check runs are found
  • Adds empty-settle-time input (default 30s) — a grace period before accepting an empty result, preventing a race where Sloth passes before other workflows have been scheduled
  • Extracts wait loop into a testable module with full test coverage
  • No change to default behaviour — existing users are unaffected

Context

When Sloth runs in a shared workflow (triggered on all PRs) alongside path-filtered workflows, PRs that don't match the path filters (e.g. docs-only changes) will never trigger other checks. Sloth currently polls for 600s then fails with a timeout, blocking the PR.

With allow-empty: "true", Sloth waits for the settle period, then succeeds if no checks have appeared. If any check appears during the settle period, Sloth resumes normal behaviour.

Test plan

  • All 41 tests pass (30 existing + 11 new)
  • Lint passes
  • Verify on a docs-only PR that Sloth passes after settle period
  • Verify on a PR with path-filtered workflows that Sloth still waits for checks

🤖 Generated with Claude Code

Mark Woolley (marknet15) and others added 3 commits April 7, 2026 15:17
When Sloth runs alongside path-filtered workflows, some PRs may not
trigger any other checks. Previously, Sloth would poll until timeout
and then fail.

The new allow-empty input (default false) lets Sloth succeed when no
other checks are found. To prevent a race condition where Sloth passes
before other workflows have been scheduled, Sloth waits for an
empty-settle-time period (default 30s) before accepting an empty result.
If any check appears during the settle period, Sloth resumes normal
wait behaviour.

No change to default behaviour — allow-empty defaults to false.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract the wait loop from index.ts into wait-for-check-runs.ts with
injectable dependencies, enabling comprehensive test coverage.

Add empty-settle-time input (default 30s) to prevent a race condition
where Sloth accepts empty before other workflows have been scheduled.
Sloth now polls for the settle period before accepting an empty result.

Test coverage for the wait loop includes:
- Standard success, failure, pending-then-success, and timeout paths
- allow-empty disabled: polls until timeout with no checks
- allow-empty enabled: waits for settle time before accepting empty
- Checks appearing during settle period resume normal behaviour
- Checks failing during settle period correctly fail
- Settle time of 0 accepts empty immediately
- Settle time exceeding timeout correctly times out

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nt rule

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@marknet15
Mark Woolley (marknet15) added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit caf95c6 Apr 7, 2026
5 checks passed
@marknet15
Mark Woolley (marknet15) deleted the feat/allow-empty-check-runs branch April 7, 2026 14:53
@lendabot lendabot Bot mentioned this pull request Apr 7, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Apr 7, 2026
I have created a release PR for this version
---


## [1.1.0](1.0.0...1.1.0)
(2026-04-07)


### Features

* Add allow-empty option for path-filtered workflow support
([#131](#131))
([caf95c6](caf95c6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: lendabot[bot] <126705550+lendabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants