Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to queue more than one GitHub Action workflow run?

I kept having GitHub Actions workflow runs canceled with the message:

Canceling since a higher priority waiting request for 'your-project' exists

Looking at the GitHub Actions docs, I see:

When a concurrent job or workflow is queued, if another job or workflow using the same 
concurrency group in the repository is in progress, the queued job or workflow will be
pending. Any previously pending job or workflow in the concurrency group will be canceled. 

So that means that only one pending workflow run is allowed. Is there a way that I could queue more than one without going to some sort of external queuing mechanism?

like image 494
Kramer Avatar asked Jun 27 '26 08:06

Kramer


2 Answers

As of 2023-11-17 the answer is no.

The concurrency feature of GitHub Actions creates two slots for a given group:

  • A single running workflow
  • A single pending workflow

The cancel-in-progress input controls the behavior of these two slots.

If cancel-in-progress: false

  1. The workflow is triggered, starts, and occupies the running workflow slot.
  2. The workflow is triggered a second time and occupies the pending slot.
  3. The workflow is triggered a third time and immediately cancelled.

Workflow run number 3 will have the message Canceling since a higher priority waiting request for 'YOUR_GROUP_NAME' exists.

This behavior is designed to ensure the "latest state" is what gets run after the currently-running operation completes.

If cancel-in-progress: true

  1. The workflow is triggered, starts, and occupies the running workflow slot.
  2. The workflow is triggered a second time and occupies the pending slot while the first workflow is cancelled.
  3. The workflow is triggered a third time, immediately cancels the second workflow and occupies the pending slot while the first workflow is cancelled.

This behavior is designed to quickly stop running jobs that no longer matter, such as pull request builds when new changes are added to the branch and need to be built.

What about preserving builds in the queue?

There is currently (2023-11-17) no way to accomplish this from a workflow, there are only workarounds like having a single runner with a special label or having a step that blocks the workflow from proceeding until other workflows complete.

like image 105
Cellivar Avatar answered Jul 02 '26 05:07

Cellivar


Use the below queue: max
This can queue up to 100 jobs.

https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency#example-queueing-multiple-pending-runs

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  queue: max
like image 38
Srinivas B Avatar answered Jul 02 '26 07:07

Srinivas B