Add concurrency key to publish/preview workflows #527
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the concurrency key
docs
to both publish and preview workflows, preventing them from running concurrently. This will help us avoid weird race conditions like the one described in #526, which came about because the preview workflow overwrote changes from the publish workflow.Additionally, the publish workflow is also given
cancel-in-progress: true
meaning that if a preview workflow is running, starting a publish workflow will cancel the preview workflow.This is probably OK because preview workflows run on PRs, and if somebody pushes to main (which triggers the publish workflow), the PR has to incorporate the new changes anyway.
The only downside to this is that there can only be one queued job at any time. So if (for example) three people are working on PRs at the same time and trigger preview workflows, one workflow would run, one workflow would be queued, and one of them would be cancelled. That scenario seems quite unlikely given the level of contributions to the docs, though, and can be fixed fairly easily by manually rerunning the workflow. (This is a weird limitation of GHA, and apparently a fix for this is on GitHub's roadmap, see https://github.com/orgs/community/discussions/41518.)
Closes #526.
CI is failing because I manually cancelled the preview workflow on this PR (it doesn't serve any purpose).