https://github.com/kachick/wait-other-jobs
⏳ Wait other jobs/workflows☕
https://github.com/kachick/wait-other-jobs
auto-merge dependabot github-actions wait
Last synced: 5 months ago
JSON representation
⏳ Wait other jobs/workflows☕
- Host: GitHub
- URL: https://github.com/kachick/wait-other-jobs
- Owner: kachick
- License: mit
- Created: 2022-05-27T12:27:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T23:02:43.000Z (about 1 year ago)
- Last Synced: 2025-03-25T02:51:31.691Z (about 1 year ago)
- Topics: auto-merge, dependabot, github-actions, wait
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/wait-other-jobs
- Size: 5.45 MB
- Stars: 9
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# wait-other-jobs
[](https://github.com/kachick/wait-other-jobs/actions/workflows/itself.yml?query=branch%3Amain)\
[](https://github.com/kachick/wait-other-jobs/actions/workflows/GH-820-graceperiod.yml?query=branch%3Amain)
[](https://github.com/kachick/wait-other-jobs/actions/workflows/GH-771-eventname.yml?query=branch%3Amain)
[](https://github.com/kachick/wait-other-jobs/actions/workflows/GH-761-matrix.yml?query=branch%3Amain)\
[](https://github.com/kachick/wait-other-jobs/actions/workflows/ci.yml?query=branch%3Amain)
This GitHub Action waits for all jobs by default even if they run in other workflows.\
You can also choose to wait for specific jobs.\
If any of the jobs fail, this action fails too.
## Usage
It works with zero or little configuration.
```yaml
jobs:
your_job:
# Enabling these permissions are required in private repositories
# permissions:
# contents: read
# checks: read
# actions: read
runs-on: ubuntu-24.04
steps:
- uses: kachick/wait-other-jobs@v4.0.0
timeout-minutes: 15 # Recommended to be enabled with your appropriate value for fail-safe use
```
You can configure the token, polling interval, allow/deny lists, and early-exit behavior as shown below.
```yaml
with:
warmup-delay: 'PT30S' # default 'PT1S'
minimum-interval: 'PT300S' # default 'PT10S'
retry-method: 'exponential_backoff' # default 'equal_intervals'
early-exit: 'false' # default 'true'
skip-same-workflow: 'true' # default 'false'
wait-list: |
[
{
"workflowFile": "ci.yml",
"jobName": "test",
"eventNames": [ "push", "pull_request" ]
},
{
"workflowFile": "release.yml",
"optional": true
}
]
skip-list: |
[
{
"workflowFile": "pages.yml"
}
]
```
Full list of the options
| NAME | DESCRIPTION | TYPE | DEFAULT | OPTIONS |
| -------------------- | ----------------------------------------------------------------------------- | -------- | -------------------------------- | --------------------------------------------------------------- |
| `github-api-url` | The GitHub API endpoint. Override for GitHub Enterprise usage. | `string` | `${{ github.api_url }}` | `https://api.github.com`, `https://ghe-host.example.net/api/v3` |
| `github-token` | The GITHUB_TOKEN secret. You can use PAT if you want. | `string` | `${{ github.token }}` | |
| `warmup-delay` | Wait this interval before first polling | `string` | `PT1S` | [ISO 8601 duration format][tc39-temporal-duration] |
| `minimum-interval` | Wait for this interval or longer between each poll to reduce GitHub API calls | `string` | `PT10S` | [ISO 8601 duration format][tc39-temporal-duration] |
| `retry-method` | How to wait for next polling | `string` | `equal_intervals` | `exponential_backoff`, `equal_intervals` |
| `early-exit` | Stop polling as soon as one job fails | `bool` | `true` | |
| `attempt-limits` | Stop polling if reached to this limit | `number` | `1000` | |
| `event-list` | Wait only listed events. Used as default for wait/skip lists | `string` | `[ "${{ github.event_name }}" ]` | JSON Array |
| `wait-list` | Wait only for these jobs | `string` | `[]` | JSON Array |
| `skip-list` | Wait for all jobs except these | `string` | `[]` | JSON Array |
| `skip-same-workflow` | Skip jobs defined in the same workflow which using this action | `bool` | `false` | |
| `dry-run` | Avoid requests for tests | `bool` | `false` | |
## Guide for option syntax and reasonable values
- GitHub API Limit: We should at least consider the `GITHUB_TOKEN`, which is limited to 1,000 requests per hour per repository.\
Roughly calculating for long jobs, setting the `minimum-interval` to `PT4S` or longer would be safer.
- [Primary Rate Limit for GITHUB_TOKEN](https://github.com/github/docs/blob/c26f36dbabb133b263c0f979f257b31d6c979341/data/reusables/rest-api/primary-rate-limit-github-token-in-actions.md)
- [Secondary Limit](https://github.com/github/docs/blob/c26f36dbabb133b263c0f979f257b31d6c979341/data/reusables/rest-api/secondary-rate-limit-rest-graphql.md)
## Schema of wait-list and skip-list
Lists should be given with JSON array, do not use both wait-list and skip-list together
### Common spec
- Must specify `workflowFile`
- Optionally specify `jobName`\
If no `jobName` is specified, all jobs in the workflow will be targeted.
- Optionally specify `eventNames`\
If no `eventNames` is specified, the global `event-list` will be used (inherited).\
If empty `[]` is specified, all events will be targeted.
### `wait-list` spec
- If the checkRun for the specified name is not found, this action fails by default.\
You can disable this validation with `"optional": true` or use the [`startupGracePeriod`](#startup-grace-period).
### `skip-list` spec
- Subset of `wait-list`. There is no `optional` and `startupGracePeriod`
- Global `event-list` filtering is applied BEFORE this list.
- If you specify `eventNames` in an item, that item will only be skipped when the event matches.
## Required GITHUB_TOKEN permissions
In public repositories, they are satisfied by default
```yaml
permissions:
contents: read # Since v2
checks: read
actions: read
```
## Support for GitHub Enterprise
To run this action in your GitHub Enterprise (GHE) instance you need to override `github-api-url`:
```yaml
with:
github-api-url: 'https://ghe-host.example.net/api/v3'
```
## outputs.
These outputs are for testing and debugging only. The schema is not defined.
- `parameters`\
Parsed values from `with` and some context.
- `dump`\
A file path for collected resources which keeps fields than logged.
## Deadlocks
When using this action in multiple jobs within the same repository, be careful to avoid deadlocks.\
The `skip-list`, `wait-list` and `skip-same-workflow` options cover this use case.
If you changed job name from the default, you should set `skip-list` or roughly use `skip-same-workflow`
```yaml
jobs:
your_job: # This will be used as the default job name if you do not specify the "name" field below
name: 'Changed at here'
runs-on: ubuntu-24.04
steps:
- uses: kachick/wait-other-jobs@v4.0.0
with:
skip-list: |
[
{
"workflowFile": "this_file_name.yml",
"jobName": "Changed at here"
}
]
timeout-minutes: 15
```
You need to consider similar problems when using matrix, because GitHub does not provide enough context.
-
-
However, you can set `jobMatchMode` to `prefix` to create a smaller skip-list and avoid this problem.
```yaml
jobs:
your_job:
strategy:
matrix:
runner:
- ubuntu-24.04
- ubuntu-24.04-arm
- ubuntu-slim # Limited to 15 minutes by GitHub
- macos-26
- windows-2025
runs-on: ${{ matrix.runner }}
steps:
- uses: kachick/wait-other-jobs@v4.0.0
with:
skip-list: |
[
{
"workflowFile": "this_file_name.yml",
"jobMatchMode": "prefix",
"jobName": "${{ github.job }}"
}
]
- run: make test
```
## Startup grace period
This action only checks the status of jobs at each polling time.\
Use this option when a job may start with a short delay after this action starts.
Example using a `wait-list`.
```yaml
with:
wait-list: |
[
{
"workflowFile": "might_be_triggered_after_0-4_minutes.yml",
"optional": false,
"startupGracePeriod": "PT5M"
}
]
```
This action starts immediately but ignores the job missing in the first 5 minutes.
- No need to extend `warmup-delay`
- Disable `optional`, because it is needed to check
- Set a sufficient value for `startupGracePeriod`.\
Use the [ISO 8601 duration format][tc39-temporal-duration].
If you're not using `wait-list`, you need to handle this pattern with `warmup-delay`.
## Alternative candidates
[gh](https://github.com/cli/cli) commands, such as `gh pr checks` and `gh run watch`, should be useful if your requirements are simple.
## Limitations
- If any workflow starts many jobs as 100+, this action does not support it.\
Because nested paging in GraphQL is complex. See [related docs](https://github.com/octokit/plugin-paginate-graphql.js/blob/a6b12e867466b0c583b002acd1cb1ed90b11841f/README.md?plain=1#L184-L218) for further detail.
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
[tc39-temporal-duration]: https://github.com/tc39/proposal-temporal/blob/0.9.0/docs/duration.md