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

related PRs is different when writing to a file #43

Open
leemeador opened this issue Nov 28, 2023 · 1 comment
Open

related PRs is different when writing to a file #43

leemeador opened this issue Nov 28, 2023 · 1 comment

Comments

@leemeador
Copy link

leemeador commented Nov 28, 2023

In this place, where it collects the PRs from the subject line to write to the changelog file,

https://github.com/requarks/changelog-action/blob/main/index.js#L36

it will collect the PRS but NOT the rightmost (last) one from the subject line and the function buildSubject will return all but the last one.

A few lines down, when it is not writing to the changelog file, it collects all of the PRs in the subject line and returns all of them.

The PRs that are returned are used to build the "related issues" section(s).

Is it ignoring the last PR on the subject line when not writing on purpose or is it a mistake.

I am adapting your code with some modifications for our use and saw this when writing some tests and noticed this.

2nd Question:

The code in this line iterates over the PR refs in the subject line

https://github.com/requarks/changelog-action/blob/main/index.js#L42

but it is in an "else" clause that only runs if there are no PRs. So its equivalent to saying "output = subject"

It looks to me like you could rewrite that line (and remove the next lines) since it will never run. Am I missing something?

@NGPixel
Copy link
Member

NGPixel commented Nov 29, 2023

  1. The reason it's a bit different is because GitHub does a bit of auto-linking when posting issue / PR ids in an issue (or in this case, release notes). So the file version requires a bit more processing to add the necessary links.

As for why the last one is excluded only in the file version, this is probably a bug. I can't recall why it was done this way.

  1. The condition matches commits that ends with a PR (so the result of a merge), while the loop goes over any PR ids in the commit message, regardless of their position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants