github
github copied to clipboard
Recursively go through PRs when adding "included in release" message.
when working with feature branches, only the branch/PR itself gets a comment - it would be awesome if all PRs merged previously into feature branch also could get a comment. 🎉
To add comments the plugin does the following:
- Get all the commits in the current release (that's all the commit on the
master
branch since the last release) - Search for all PRs/Issues references in the commit messages and add a comment for each one
- Search all the PRs that contains a commit that is part of the release and add a comment for each one
- Search the body of each PR found previously and look for a closing keyword (like
Fix #xyz
) and add a comment for each issue found
Can you clarify in which exact scenario a comment is missing? Do you have a link to a repo where this problem happens? Please mention every step you followed, and provide links to related PRs/commits/issues.
This PR merges feature branch into master - has comment: https://github.com/dcos/dcos-ui/pull/3154 This PR was merged into feature branch before, no comment: https://github.com/dcos/dcos-ui/pull/3151
We use rebase and merge and there was another issue with finding the first PR at all before 🤔
A similar problem was fixed in https://github.com/semantic-release/github/releases/tag/v5.0.2. When the problematic case was merged which version of the plugin were you using?
yeah, I reported that issue 😅we're using 5.0.2
Oh ok sorry.
So if I understand correctly, the PR dcos/dcos-ui#3151 was opened against the branch jg/DCOS-39896-service-region
, then jg/DCOS-39896-service-region
was merged into master
.
Unfortunately it doesn't seems the GitHub API offer a way to trace back commits in such case.
The functionality relies on the Issue Search API that allow to find the parent PR of a commit.
So when semantic-release runs it finds the commit e82a0c7
, perform a search which returns the PR #3154
. That works even though that commit has the sha d61848c
when it was on the branch feature/DCOS-39895-services-region-info
. The sha changed due to "Rebase and Merge" but the Search API can still make the connection.
The problem is there is no way (that I'm aware of) to figure out that the commit d61848c
on branch feature/DCOS-39895-services-region-info
came from the commit 14d19a1
on PR #3151
.
If you know a way to do that I can certainly look at implementing it. Otherwise I'm afraid it's not possible.
jg/DCOS-39896-service-region
got merged into feature/DCOS-39895-services-region-info
and then feature/DCOS-39895-services-region-info
got merged into master
.
if your able to find the PR of the master
commit on feature/DCOS-39895-services-region-info
, isnt the same thing possible from feature/DCOS-39895-services-region-info
to jg/DCOS-39896-service-region
? basicly go through all of the commits recusively until you cant find a PR anymore. 🤔
if your able to find the PR of the master commit on feature/DCOS-39895-services-region-info, isnt the same thing possible from feature/DCOS-39895-services-region-info to jg/DCOS-39896-service-region? basicly go through all of the commits recusively until you cant find a PR anymore. 🤔
It doesn't seems so...
Getting the commits from #3154
:
curl https://api.github.com/repos/dcos/dcos-ui/pulls/3154/commits
// => "sha": "d61848c1232724e82c100b10746ff418e69c1682"
Searching for the sha of the commit in #3154
:
curl https://api.github.com/search/issues?q=d61848c1232724e82c100b10746ff418e69c1682
// => "number": 3154
The search returns only #3154
and not #3151
. So it seems that whatever GitHub keeps internally to make the link between master
/e82a0c7
and feature/DCOS-39895-services-region-info
/d61848c
is not preserved for making the link between feature/DCOS-39895-services-region-info
/d61848c
and jg/DCOS-39896-service-region
/14d19a1
.
Basically what we would need is an API call or a sequence of API call that would get me from master
/e82a0c7
to PR #3151
.
yup, agree - also wasnt able to find the missing link 😞
If you think it worth it and if you have a way to make a feature request to GitHub so they add a way to do that in the API, please go ahead 😃
I have something similar here: https://github.com/Sonia-corporation/il-est-midi-discord/pull/272. An issue is related: https://github.com/Sonia-corporation/il-est-midi-discord/issues/265
I was expecting a comment from the Bot nevertheless it did not occured. It this something that should work or not? Based on @pvdlg response I am not sure since the issue was never mentioned in a comment, only in GitHub directly.