Make job-discriminator warning actionable when using default concurrency
- Dominant language
- Go
- Stars
- 5.1k
- Forks
- 541
- Avg merge
- 5h 48m
- Merged PRs (30d)
- 773
Description
## Problem
The warning added for #55813 identifies the fan-out concurrency problem, but it is difficult to act on when a workflow does not declare `concurrency` and relies on gh-aw's generated default:
> workflow_dispatch workflow has no concurrency.job-discriminator; the generated conclusion concurrency group is shared by all dispatches of this workflow. Set a discriminator (for example, `${{ github.run_id }}`) to give each dispatch its own slot.
A user can reasonably look for an existing `concurrency` block to edit and find none. The diagnostic does not explain that `concurrency.job-discriminator` is a gh-aw extension that can be added by itself to augment the generated concurrency configuration rather than replacing it.
## User action
Add this to the workflow frontmatter, even when no `concurrency` declaration currently exists:
```yaml
concurrency:
job-discriminator: ${{ github.run_id }}
```
Use an input expression instead when dispatches with the same input should intentionally share a slot.
## Proposed diagnostic
> workflow_dispatch defines inputs, but concurrency.job-discriminator is not set; concurrent dispatches share gh-aw's generated job concurrency groups. To give each dispatch its own slot while keeping the default concurrency configuration, add this to the workflow frontmatter:
>
> concurrency:
> job-discriminator: ${{ github.run_id }}
>
> Use an input expression instead if dispatches with the same input should share a slot. See: https://gh.io/gh-aw/reference/concurrency#fan-out-concurrency-job-discriminator
This makes the required edit explicit, explains that the generated defaults remain in effect, and links to the detailed semantics.
## Local prototype
A local change updates `emitGeneralToolWarnings` with the proposed wording and strengthens `TestWorkflowDispatchConcurrencyWarning` to assert the snippet, default-concurrency explanation, and documentation link. The focused test passes, and compiling a real workflow with `--no-emit` prints the actionable snippet.
Contributor guide
Assessment
This issue has not been assessed yet.