> For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt.

# Concurrency

A concurrency group runs its members one at a time. `concurrency:` at the top makes each run of the pipeline a member; on a job, the job is one, across runs. Groups are shared by every project of the org, so two repositories can guard one deploy target.

```yaml
version: 0
on: [push]
concurrency:
  group: ci-${{ event.branch }}
  policy: cancel_other
jobs:
  deploy:
    concurrency: {group: deploy-production}
    image: alpine:3.22
    steps:
      - run: ./deploy.sh
```

`group` is the group's name; it can read `event`, `vars` and a job's `matrix`, not `jobs`. `policy` says what a new member does when the group is busy:

| Policy                 |                                                            |
| ---------------------- | ---------------------------------------------------------- |
| `buffer_all` (default) | Wait behind every member that joined earlier               |
| `buffer_one`           | Wait, and supersede the members waiting before it          |
| `skip`                 | Don't run if the group is busy                             |
| `cancel_other`         | Supersede every other member, running or waiting, then run |
| `allow`                | No group: run in parallel. Top level only                  |

Without a top-level `concurrency:`, a pull request's runs share a group with `cancel_other`, so a new push supersedes the older runs; `concurrency: {policy: allow}` turns that off. Superseded members end `cancelled`. `hod local run` runs one run, so only jobs whose groups have the same name wait for each other.
