This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 431785f306 GH-14790: [Dev] Avoid extra comment with Closes issue id on
PRs (#35811)
431785f306 is described below
commit 431785f3062199b2b9052902b67492b933744833
Author: Raúl Cumplido <[email protected]>
AuthorDate: Tue May 30 10:37:31 2023 +0200
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:
https://github.com/raulcd/arrow/pull/79
### Are there any user-facing changes?
No
* Closes: #14790
Lead-authored-by: Raúl Cumplido <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
.github/workflows/dev_pr/link.js | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/dev_pr/link.js b/.github/workflows/dev_pr/link.js
index 1fbd044717..05e6a85a87 100644
--- a/.github/workflows/dev_pr/link.js
+++ b/.github/workflows/dev_pr/link.js
@@ -83,22 +83,16 @@ async function commentGitHubURL(github, context,
pullRequestNumber, issueID) {
// Make the call to ensure issue exists before adding comment
const issueInfo = await helpers.getGitHubInfo(github, context, issueID,
pullRequestNumber);
const message = "* Closes: #" + issueInfo.number
- if (await haveComment(github, context, pullRequestNumber, message)) {
- return;
- }
- if (issueInfo){
+ if (issueInfo) {
+ if (context.payload.pull_request.body.includes(message)) {
+ return;
+ }
await github.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullRequestNumber,
body: (context.payload.pull_request.body || "") + "\n" + message
});
- await github.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: pullRequestNumber,
- body: message
- });
}
}