Skip to content

Commit 431785f

Browse files
raulcdkou
andauthored
GH-14790: [Dev] Avoid extra comment with Closes issue id on PRs (#35811)
### Rationale for this change We are duplicating the Closes issue_id comment on PRs adding it to both the PR body and a comment. There was some discussion to remove it from the comment. ### What changes are included in this PR? Remove adding extra comment to PR and check whether `Closes XXX` was already added on the body instead of checking comment. ### Are these changes tested? Yes, I have tested on my fork, see this PR: raulcd#79 ### Are there any user-facing changes? No * Closes: #14790 Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 1951a1a commit 431785f

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

.github/workflows/dev_pr/link.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,16 @@ async function commentGitHubURL(github, context, pullRequestNumber, issueID) {
8383
// Make the call to ensure issue exists before adding comment
8484
const issueInfo = await helpers.getGitHubInfo(github, context, issueID, pullRequestNumber);
8585
const message = "* Closes: #" + issueInfo.number
86-
if (await haveComment(github, context, pullRequestNumber, message)) {
87-
return;
88-
}
89-
if (issueInfo){
86+
if (issueInfo) {
87+
if (context.payload.pull_request.body.includes(message)) {
88+
return;
89+
}
9090
await github.pulls.update({
9191
owner: context.repo.owner,
9292
repo: context.repo.repo,
9393
pull_number: pullRequestNumber,
9494
body: (context.payload.pull_request.body || "") + "\n" + message
9595
});
96-
await github.issues.createComment({
97-
owner: context.repo.owner,
98-
repo: context.repo.repo,
99-
issue_number: pullRequestNumber,
100-
body: message
101-
});
10296
}
10397
}
10498

0 commit comments

Comments
 (0)