Skip to content

🛠 Tooling: Add cancel-in-progress to release job #556

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

Closed
3 tasks done
JoshuaKGoldberg opened this issue Jun 16, 2023 · 2 comments · Fixed by #568
Closed
3 tasks done

🛠 Tooling: Add cancel-in-progress to release job #556

JoshuaKGoldberg opened this issue Jun 16, 2023 · 2 comments · Fixed by #568
Labels
area: tooling Managing the repository's maintenance good first issue Good for newcomers, please hop on! status: accepting prs Please, send a pull request to resolve this!

Comments

@JoshuaKGoldberg
Copy link
Owner

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

Right now, release.yml -the workflow job that releases new versions of the package upon commits to the main branch- is set to never cancel in-progress releases workflows:

https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/d4b1c7950e8cb8886eb98aff4223079b343936a8/.github/workflows/release.yml#L1-L2

In other words: if there are two commits merged to the main branch quickly, they'll both have the release workflow run on them, in series. The second commit's workflow will wait until the first one's is done.

However, the first commit's workflow will always fail if it's behind the main branch in terms of commits! Example from https://github.com/JoshuaKGoldberg/template-typescript-node-package/actions/runs/5292082143/jobs/9578516799:

Changeset:
 M package.json
ERROR To https://github.com/JoshuaKGoldberg/template-typescript-node-package
 * [new tag]         v1.28.25 -> v1.28.25
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/JoshuaKGoldberg/template-typescript-node-package'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Rolling back changes...

So, I think we should change the workflow to cancel-in-progress: true. That way, when there are multiple quick commits, on the last one's release workflow will run. And it'll release a new version with each commit's changes.

Accepting PRs to make this one line change 😄. Leaving it open as a good first issue as it's not time-sensitive.

Additional Info

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency explains concurrency.

@JoshuaKGoldberg JoshuaKGoldberg added good first issue Good for newcomers, please hop on! area: tooling Managing the repository's maintenance status: accepting prs Please, send a pull request to resolve this! labels Jun 16, 2023
Jolg42 added a commit to Jolg42/template-typescript-node-package that referenced this issue Jun 17, 2023
@Jolg42
Copy link
Contributor

Jolg42 commented Jun 17, 2023

I opened a small PR #568 😉

JoshuaKGoldberg pushed a commit that referenced this issue Jun 17, 2023
<!-- 👋 Hi, thanks for sending a PR to template-typescript-node-package!
💖.
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

- [x] Addresses an existing open issue: fixes  #556
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

I switched `cancel-in-progress: false` to `true` in the 2 relevant
files.
@github-actions
Copy link

🎉 This is included in version v1.28.34 🎉

The release is available on:

Cheers! 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: tooling Managing the repository's maintenance good first issue Good for newcomers, please hop on! status: accepting prs Please, send a pull request to resolve this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants