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: Existing description and badges not detected #751

Closed
3 tasks done
JoshuaKGoldberg opened this issue Sep 2, 2023 · 1 comment · Fixed by #847
Closed
3 tasks done

🐛 Bug: Existing description and badges not detected #751

JoshuaKGoldberg opened this issue Sep 2, 2023 · 1 comment · Fixed by #847
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 2, 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

When migrating an existing repository, if the README.md already contains centered paragraphs for description and/or badges, they shouldn't be replaced.

Actual

I tried migrating a package that already had them and they were duplicated:

<h1 align="center">All Contributors Auto Action</h1>

<p align="center">Fills in missing allcontributors entries for a repository. 👪</p>

+ <p align="center">
+ 	<a href="#contributors" target="_blank">
+ <!-- prettier-ignore-start -->
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
+ <img alt="All Contributors: 1" src="https://img.shields.io/badge/all_contributors-1-21bb42.svg" />
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
+ <!-- prettier-ignore-end -->
+ </a><a href="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-auto-action" target="_blank">
+ 	<img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-auto-action/branch/main/graph/badge.svg"/>
+ </a><a href="https://github.com/JoshuaKGoldberg/all-contributors-auto-action/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
+ 	<img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
+ </a><a href="https://github.com/JoshuaKGoldberg/all-contributors-auto-action/blob/main/LICENSE.md" target="_blank">
+ 	<img alt="License: MIT" src="https://img.shields.io/github/license/JoshuaKGoldberg/all-contributors-auto-action?color=21bb42">
+ </a><img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" /><img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />
+ </p>
+ 
+ <p align="center">Fills in missing allcontributors entries for a repository. 👪</p>
+ 
<p align="center">
	<a href="#contributors" target="_blank">
<!-- prettier-ignore-start -->
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<img alt="All Contributors: 1" src="https://img.shields.io/badge/all_contributors-1-21bb42.svg" />
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
	</a>
	<a href="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-auto-action" target="_blank">
		<img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-auto-action/branch/main/graph/badge.svg?token=eVIFY4MhfQ"/>
	</a>
	<a href="https://github.com/JoshuaKGoldberg/all-contributors-auto-action/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
		<img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
	</a>
	<a href="https://github.com/JoshuaKGoldberg/all-contributors-auto-action/blob/main/LICENSE.md" target="_blank">
	    <img alt="License: MIT" src="https://img.shields.io/github/license/JoshuaKGoldberg/all-contributors-auto-action?color=21bb42">
    </a>
	<a href="https://github.com/sponsors/JoshuaKGoldberg" target="_blank">
    	<img alt="Sponsor: On GitHub" src="https://img.shields.io/badge/sponsor-on_github-21bb42.svg" />
    </a>
	<img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />
    <img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />
</p>

Additional Info

Discovered on https://github.com/JoshuaKGoldberg/all-contributors-auto-action/tree/1ce7a4d2df5fd69765b7d407654847fde9e30340:

git clone https://github.com/JoshuaKGoldberg/all-contributors-auto-action
cd all-contributors-auto-action
git checkout 1ce7a4d2df5fd69765b7d407654847fde9e30340
pnpm i
npx create-typescript-app --base everything --mode migrate

It might be the case that this only happens if there's a change to --description or some other data.

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

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

- [x] Detecting existing badges
- [x] Splicing new badges alongside existing equivalents and other
badges
- [x] Inject into an existing `<p>...</p>` instead of prepending a new
one

`writeReadme`'s logic is complex enough now that I gave it its own
`writeReadme/index.ts`.

Verified with unit tests in the PR as well as running
JoshuaKGoldberg/all-contributors-auto-action#68
locally.
@github-actions
Copy link

🎉 This is included in version v1.29.48 🎉

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