Skip to content

Commit

Permalink
Replace the Cancel workflow with native GitHub Action functionality. (#…
Browse files Browse the repository at this point in the history
…32016)

* Replace the Cancel workflow with native GitHub Action functionality.

Recently, GitHub introduced the `concurrency` option for ensuring that only a single job or workflow using the same concurrency group will run at a time.

Currently, there is a Cancel workflow in the repo that aims to accomplish the same thing. However, when a backlog exists, the Cancel workflow for each commit does not run until its turn in the queue is reached. This can result in the backlog ballooning.

The `concurrency` option in GitHub Actions runs a check when a workflow is queued, skipping the need to wait for an available runner to cancel old workflows.
  • Loading branch information
desrosj authored May 20, 2021
1 parent a05c4b6 commit 7b39dd7
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ on:
description: 'rc or stable?'
required: true

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
bump-version:
name: Bump version
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: Compressed Size

on: [pull_request]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
build:
name: Check
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/cancel.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/create-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ on:
push:
branches: [trunk, wp/trunk]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
checks:
name: Checks
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
- 'release/**'
- 'wp/**'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
admin:
name: Admin - ${{ matrix.part }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ on:
release:
types: [published]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
performance:
name: Run performance tests
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ on:
push:
branches: [trunk]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test:
runs-on: macos-latest
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ on:
push:
branches: [trunk]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test:
runs-on: macos-latest
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
- 'release/**'
- 'wp/**'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
check:
name: All
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ on:
- 'release/**'
- 'wp/**'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
unit-js:
name: JavaScript
Expand Down

0 comments on commit 7b39dd7

Please sign in to comment.