-
Notifications
You must be signed in to change notification settings - Fork 389
Add concurrency
settings to PR checks
#3128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a concurrency configuration to generated PR check workflows to limit simultaneous runs per workflow/ref, cancelling superseded pull_request runs while serializing other event types. Key goal is to reduce parallel workflow executions and associated API load.
- Adds concurrency block (group = workflow + ref) into workflow generation template (sync.py).
- Regenerates all auto-generated workflow YAML files to include the concurrency settings.
- Improves operational efficiency by cancelling obsolete PR runs and queueing non-PR runs.
Reviewed Changes
Copilot reviewed 56 out of 56 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pr-checks/sync.py | Adds concurrency configuration template used to regenerate workflows. |
.github/workflows/__with-checkout-path.yml | Generated: adds concurrency block. |
.github/workflows/__upload-ref-sha-input.yml | Generated: adds concurrency block. |
.github/workflows/__upload-quality-sarif.yml | Generated: adds concurrency block. |
.github/workflows/__unset-environment.yml | Generated: adds concurrency block. |
.github/workflows/__test-proxy.yml | Generated: adds concurrency block. |
.github/workflows/__test-local-codeql.yml | Generated: adds concurrency block. |
.github/workflows/__test-autobuild-working-dir.yml | Generated: adds concurrency block. |
.github/workflows/__swift-custom-build.yml | Generated: adds concurrency block. |
.github/workflows/__swift-autobuild.yml | Generated: adds concurrency block. |
.github/workflows/__submit-sarif-failure.yml | Generated: adds concurrency block. |
.github/workflows/__start-proxy.yml | Generated: adds concurrency block. |
.github/workflows/__split-workflow.yml | Generated: adds concurrency block. |
.github/workflows/__rust.yml | Generated: adds concurrency block. |
.github/workflows/__ruby.yml | Generated: adds concurrency block. |
.github/workflows/__rubocop-multi-language.yml | Generated: adds concurrency block. |
.github/workflows/__resolve-environment-action.yml | Generated: adds concurrency block. |
.github/workflows/__remote-config.yml | Generated: adds concurrency block. |
.github/workflows/__quality-queries.yml | Generated: adds concurrency block. |
.github/workflows/__packaging-inputs-js.yml | Generated: adds concurrency block. |
.github/workflows/__packaging-config-js.yml | Generated: adds concurrency block. |
.github/workflows/__packaging-config-inputs-js.yml | Generated: adds concurrency block. |
.github/workflows/__packaging-codescanning-config-inputs-js.yml | Generated: adds concurrency block. |
.github/workflows/__overlay-init-fallback.yml | Generated: adds concurrency block. |
.github/workflows/__multi-language-autodetect.yml | Generated: adds concurrency block. |
.github/workflows/__language-aliases.yml | Generated: adds concurrency block. |
.github/workflows/__job-run-uuid-sarif.yml | Generated: adds concurrency block. |
.github/workflows/__javascript-source-root.yml | Generated: adds concurrency block. |
.github/workflows/__init-with-registries.yml | Generated: adds concurrency block. |
.github/workflows/__go-tracing-legacy-workflow.yml | Generated: adds concurrency block. |
.github/workflows/__go-tracing-custom-build-steps.yml | Generated: adds concurrency block. |
.github/workflows/__go-tracing-autobuilder.yml | Generated: adds concurrency block. |
.github/workflows/__go-indirect-tracing-workaround.yml | Generated: adds concurrency block. |
.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml | Generated: adds concurrency block. |
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml | Generated: adds concurrency block. |
.github/workflows/__go-custom-queries.yml | Generated: adds concurrency block. |
.github/workflows/__extractor-ram-threads.yml | Generated: adds concurrency block. |
.github/workflows/__export-file-baseline-information.yml | Generated: adds concurrency block. |
.github/workflows/__diagnostics-export.yml | Generated: adds concurrency block. |
.github/workflows/__cpp-deptrace-enabled.yml | Generated: adds concurrency block. |
.github/workflows/__cpp-deptrace-enabled-on-macos.yml | Generated: adds concurrency block. |
.github/workflows/__cpp-deptrace-disabled.yml | Generated: adds concurrency block. |
.github/workflows/__config-input.yml | Generated: adds concurrency block. |
.github/workflows/__config-export.yml | Generated: adds concurrency block. |
.github/workflows/__cleanup-db-cluster-dir.yml | Generated: adds concurrency block. |
.github/workflows/__bundle-zstd.yml | Generated: adds concurrency block. |
.github/workflows/__bundle-toolcache.yml | Generated: adds concurrency block. |
.github/workflows/__build-mode-rollback.yml | Generated: adds concurrency block. |
.github/workflows/__build-mode-none.yml | Generated: adds concurrency block. |
.github/workflows/__build-mode-manual.yml | Generated: adds concurrency block. |
.github/workflows/__build-mode-autobuild.yml | Generated: adds concurrency block. |
.github/workflows/__autobuild-direct-tracing.yml | Generated: adds concurrency block. |
.github/workflows/__autobuild-direct-tracing-with-working-dir.yml | Generated: adds concurrency block. |
.github/workflows/__autobuild-action.yml | Generated: adds concurrency block. |
.github/workflows/__analyze-ref-input.yml | Generated: adds concurrency block. |
.github/workflows/__all-platform-bundle.yml | Generated: adds concurrency block. |
# consequently the number of concurrent API requests. | ||
'cancel-in-progress': "${{ github.event_name == 'pull_request' }}", | ||
# The group is determined by the workflow name + the ref | ||
'group': "${{ github.workflow }}-${{ github.ref }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is this prevents duplicate checks on the same ref due to marking ready for review, for instance. However couldn't we go further and base the concurrency group on the PR number, so that new pushes cancel runs for previous pushes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs:
For workflows triggered by
pull_request
, this is the pull request merge branch. For workflows triggered byrelease
, this is the release tag created. For other triggers, this is the branch or tag ref that triggered the workflow run. This is only set if a branch or tag is available for the event type. The ref given is fully-formed, meaning that for branches the format isrefs/heads/<branch_name>
. For pull requests events exceptpull_request_target
, it isrefs/pull/<pr_number>/merge
.pull_request_target
events have theref
from the base branch. For tags it isrefs/tags/<tag_name>
. For example,refs/heads/feature-branch-1
.
So for pull_request
events, we should get the fully-formed branch name (not the commit ref). You can see this in action on this PR: a bunch of in-progress workflows for 6fcf631 got cancelled because I pushed 2d8d639.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification!
This PR updates
sync.py
to addconcurrency
settings to all PR checks so that:ref
.pull_request
events, in-progress workflows in the same concurrency group are cancelled if a new workflow is starting.This should reduce the number of concurrent workflows that we have running for the repo.
Risk assessment
For internal use only. Please select the risk level of this change:
Merge / deployment checklist