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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: Migrating a non-JoshuaKGoldberg repo creates the wrong owners for JoshuaKGoldberg actions #1043

Closed
3 tasks done
JoshuaKGoldberg opened this issue Nov 18, 2023 · 4 comments · Fixed by #1078
Closed
3 tasks done
Assignees
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

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.

Expected

Running --mode migrate on an existing repo under a owner other than JoshuaKGoldberg should still set up actions like JoshuaKGoldberg/release-it-action under the proper owners.

Actual

I'd missed in omnidan/node-emoji#142 that two actions were set up incorrectly:

  • omnidan/all-contributors-auto-action was configured instead of JoshuaKGoldberg/all-contributors-auto-action
  • omnidan/release-it-action was configured instead of JoshuaKGoldberg/release-it-action

Additional Info

No response

@jaas666
Copy link
Contributor

jaas666 commented Dec 2, 2023

I was able to reproduce this bug but can't figure out why it happens.
The only thing that caught my eye was this line that's using string literals instead of double quotes, although I'm pretty sure that shouldn't cause the issue.

I'd still change it to double quotes just to pass the OCD test. 🤣

@jaas666
Copy link
Contributor

jaas666 commented Dec 2, 2023

I think I found the issue. I commented this line and the yml files are created correctly without JoshuaKGoldberg being replaced.

[/JoshuaKGoldberg(?!\/console-fail-test)/g, options.owner],

If this is indeed the issue, what would you suggest as the proper solution instead of commenting the line?

@JoshuaKGoldberg
Copy link
Owner Author

Hmm, yeah, it's tricky. I never liked having that specific console-fail-test exclusion in there. Very brittle.

The array of replacements including that entry go down to replace-in-file, which has a callback option for to. Maybe a callback that doesn't change a known list of good names (console-fail-test, all-contributors-auto-action, ...)?

And/or: maybe only replace a repo path like JoshuaKGoldberg/... if the ... is create-typescript-app? So JoshuaKGoldberg/create-typescript-app would be replaced, but not JoshuaKGoldberg/console-fail-test, JoshuaKGoldberg/all-contributors-auto-action, etc.?

JoshuaKGoldberg added a commit that referenced this issue Dec 7, 2023
## PR Checklist

- [x] Addresses an existing open issue: fixes #1043
- [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

Uses a [`to`
callback](https://github.com/adamreisnz/replace-in-file/#using-callbacks-for-to)
to determine whether to swap out owner to `options.owner` in
`"JoshuaKGoldberg"` _(always)_ or `"JoshuaKGoldberg/..."` (if the `...`
is `options.repository`).

Also fixes some existing edge cases around owner replacements:

* Syncs up the end-of-readme attribution notice so there's only one
place it's written in the templates
* Uses `options.owner` and `options.repository` in
`createDotGitHubFiles` instead of hardcoding
`JoshuaKGoldberg/create-typescript-app`.
Copy link

github-actions bot commented Dec 7, 2023

🎉 This is included in version v1.49.1 🎉

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
2 participants