Skip to content

github-action/prefer-cancel-in-progress

Prefer setting concurrency cancel-in-progress to true.

📖 Rule Details

This rule reports when a concurrency block does not set cancel-in-progress: true.

The rule checks both workflow-level and job-level concurrency.

yaml
name: CI

concurrency:
  group: ci-main
  cancel-in-progress: true

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: pnpm test
correct
yaml
name: CI

concurrency:
  group: ci-main
yaml
name: CI

jobs:
  test:
    runs-on: ubuntu-latest
    concurrency:
      group: test-main
      cancel-in-progress: false
    steps:
      - run: pnpm test
incorrect

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-github-action v0.3.0

🔍 Implementation