Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug: Releases can become broken after two quick pushes to main #862

Closed
3 tasks done
JoshuaKGoldberg opened this issue Sep 21, 2023 · 1 comment 路 Fixed by #876
Closed
3 tasks done

馃悰 Bug: Releases can become broken after two quick pushes to main #862

JoshuaKGoldberg opened this issue Sep 21, 2023 · 1 comment 路 Fixed by #876
Assignees
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Sep 21, 2023

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.

Expected

Back in #556 I'd requested changing the release workflow to cancel-in-progress: true. The idea was that if they were running in series, later workflows wouldn't have up-to-date commits from main. I'd thought this would fix the checked-in version to always be in sync with what was published to npm.

The general flow is meant to be:

  1. Commit A is pushed
  2. Commit A's release flow starts
  3. Commit A's release is published to npm
  4. Commit A's Git commit is pushed to GitHub
  5. Commit A's release flow finishes
  6. ...some time later
  7. Commit B is pushed
  8. etc.

Actual

Unfortunately, there's still a race condition. Take the following order:

  1. Commit A is pushed
  2. Commit A's release flow starts
  3. Commit A publishes to npm
  4. Commit B is pushed
  5. Commit B's release flow starts
  6. Commit A's release flow is canceled

Note that Commit A's Git commit was never pushed to GitHub.

Additional Info

Example CI failure: https://github.com/JoshuaKGoldberg/create-typescript-app/actions/runs/6262715180/job/17005549976

npm notice === Tarball Details === 
npm notice name:          create-typescript-app                   
npm notice version:       1.30.0                                  
npm notice filename:      create-typescript-app-1.30.0.tgz        
npm notice package size:  101.4 kB                                
npm notice unpacked size: 379.1 kB                                
npm notice shasum:        4a38a5622710939ba6aa9cd66dbd8f3ba3f922a9
npm notice integrity:     sha512-Oq4LkNynwxKmH[...]fMZaQDqiHR+fA==
npm notice total files:   262                                     
npm notice 
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access
npm notice publish Signed provenance statement with source and build information from GitHub Actions
npm notice publish Provenance statement published to transparency log: https://search.sigstore.dev/?logIndex=37720651
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/create-typescript-app - You cannot publish over the previously published versions: 1.30.0.
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

Looks like https://github.com/orgs/community/discussions/12835 discusses proposals for a built-in way to avoid this classification of issue.

@JoshuaKGoldberg JoshuaKGoldberg added the type: bug Something isn't working :( label Sep 21, 2023
@JoshuaKGoldberg JoshuaKGoldberg added this to the Post-Rename Migration milestone Sep 21, 2023
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Sep 21, 2023
@JoshuaKGoldberg JoshuaKGoldberg added the status: accepting prs Please, send a pull request to resolve this! label Sep 21, 2023
JoshuaKGoldberg added a commit that referenced this issue Sep 22, 2023
## PR Checklist

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

## Overview

Switches `actions/checkout@4` to fetch from `ref: main` (the branch)
instead of the commit that triggered the workflow. Doing so should mean
that every release workflow runs on the latest commit as of when it
_starts_.

This should mean that if N release-worthy commits occur quickly:

1. The first one should always finish releasing nicely
2. The remaining 1...N commits will each 

I don't love that this solution results in 1...N release workflows each
deleting branch protection, doing nothing, then recreating the branch
protection. But given
https://github.com/orgs/community/discussions/12835 I don't see a way
around it. The branch protection shenanigans should be made better by
#145.
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

馃帀 This is included in version v1.32.0 馃帀

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
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant