Skip to content

chore: Cleanup incorrect links in CHANGELOG.md#13857

Merged
SimenB merged 5 commits into
jestjs:mainfrom
SuperSodaSea:chore/cleanup-changelog
Feb 5, 2023
Merged

chore: Cleanup incorrect links in CHANGELOG.md#13857
SimenB merged 5 commits into
jestjs:mainfrom
SuperSodaSea:chore/cleanup-changelog

Conversation

@SuperSodaSea

@SuperSodaSea SuperSodaSea commented Feb 3, 2023

Copy link
Copy Markdown
Contributor

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

SimenB commented Feb 5, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

Comment thread scripts/checkChangelog.mjs Outdated

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@github-actions

github-actions Bot commented Mar 9, 2023

Copy link
Copy Markdown

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.

3 participants