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

chore: Cleanup incorrect links in CHANGELOG.md #13857

Merged
merged 5 commits into from Feb 5, 2023

Conversation

SuperSodaSea
Copy link
Contributor

@SuperSodaSea SuperSodaSea commented Feb 3, 2023

Summary

I happened to find some of the PRs' links in CHANGELOG.md are incorrect (different IDs in text and URLs), due to mistake when copying and pasting them:

https://github.com/facebook/jest/blob/48ddbf49535290aa9cd0e990f44d583c1baab96e/CHANGELOG.md?plain=1#L862

So I wrote a small script like this to find all of them (hopefully):

const fs = require('fs');

const regex =
  /\[#(\d+)\]\(https:\/\/github.com\/facebook\/jest\/pull\/(\d+)\)/g;
const data = fs.readFileSync('CHANGELOG.md', 'utf-8');
for (const match of data.matchAll(regex))
  if (match[1] !== match[2]) console.error(`Error: ${match[0]}`);

And it outputs:

Error: [#12763](https://github.com/facebook/jest/pull/12899)
Error: [#11523](https://github.com/facebook/jest/pull/11567)
Error: [#8751](https://github.com/facebook/jest/pull/8829)
Error: [#10393](https://github.com/facebook/jest/pull/10400)
Error: [#10217](https://github.com/facebook/jest/pull/10237)
Error: [#8448](https://github.com/facebook/jest/pull/8665)
Error: [#7985](https://github.com/facebook/jest/pull/8003)
Error: [#7809](https://github.com/facebook/jest/pull/7972)
Error: [#6792](https://github.com/facebook/jest/pull/6810)
Error: [#5948](https://github.com/facebook/jest/pull/5953)
Error: [#5858](https://github.com/facebook/jest/pull/3497)
Error: [#5154](https://github.com/facebook/jest/pull/5502)
Error: [#4837](https://github.com/facebook/jest/pull/4629)

I manually checked them one by one and fixed them in this PR.

Test plan

(Maybe we can add a step somewhere in the CI to detect such error.)

A CI step is added to check this, see discussion below.

@SuperSodaSea SuperSodaSea changed the title chore: Cleanup incorrect URLs in CHANGELOG.md chore: Cleanup incorrect links in CHANGELOG.md Feb 3, 2023
@SimenB
Copy link
Member

SimenB commented Feb 5, 2023

Ah nice, thanks @SuperSodaSea!

So I wrote a small script like this to find all of them (hopefully):

Can you add that script to the repo? We can run it as part of some CI run to verify links are correct

@SuperSodaSea
Copy link
Contributor Author

@SimenB I added scripts/checkChangelog.mjs, it will emit error like this when error is detected:

CHANGELOG.md:298:72: error: Link is incorrect: [#12763](https://github.com/facebook/jest/pull/12899)

It can be run via yarn check-changelog, and I added a check-changelog step to the Lint job of CI.

scripts/checkChangelog.mjs Outdated Show resolved Hide resolved
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants