Skip to content

AO3-7341 Add concurrency-key on Automated tests#5652

Open
onefangg wants to merge 1 commit intootwcode:masterfrom
onefangg:AO3-7341
Open

AO3-7341 Add concurrency-key on Automated tests#5652
onefangg wants to merge 1 commit intootwcode:masterfrom
onefangg:AO3-7341

Conversation

@onefangg
Copy link
Contributor

@onefangg onefangg commented Mar 21, 2026

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7341

Purpose

What does this PR do?

Cancels previous workflow runs for automated tests, if there is a newer run queued. The concurrency key is added just for automated tests as specified in the ticket, but I could also add it to reviewdog.yml as it also runs on pull_request trigger.

Testing Instructions

After this has been merged to master, PRs that have commits pushed while the automated tests are still running will result in said tests being cancelled. ie. Automated tests will only be ran for the latest commit push, previously queued tasks will be cancelled.

Example of my own testing:

I've created the PR which creating this first test run, then made a cosmetic change to my commit message by running git commit --amend then git push --force-with-lease to force a diff commit hash, resulting in the second test run being queued, which causes the first test run to be cancelled

Credit

Yi Fang (she/her)

@github-actions github-actions bot added Scope: Tests Only Only changes automated tests or test configuration Awaiting Review labels Mar 21, 2026
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this Stack Overflow comment, let's instead use:

${{ github.workflow }}-${{ github.ref || github.run_id }}

github.ref also covers pull requests, and github.run_id is guaranteed to exist on any run.

- To cancel previously queued jobs per branch head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Coder Has Actioned Review Scope: Tests Only Only changes automated tests or test configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants