Skip to content

Commit 0df414e

Browse files
authored
GH-35943: [Dev] Ensure link issue works when PR body is empty (#36460)
### Rationale for this change Fix a bug when PR body is empty and Dev workflow fails. ### What changes are included in this PR? Ensure the link issue comment works in case of description being empty. ### Are these changes tested? I have tested it on my fork here: raulcd#81 ### Are there any user-facing changes? No * Closes: #35943 Authored-by: Raúl Cumplido <raulcumplido@gmail.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 20d5c31 commit 0df414e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/dev_pr/link.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@ async function commentGitHubURL(github, context, pullRequestNumber, issueID) {
8484
const issueInfo = await helpers.getGitHubInfo(github, context, issueID, pullRequestNumber);
8585
const message = "* Closes: #" + issueInfo.number
8686
if (issueInfo) {
87-
if (context.payload.pull_request.body.includes(message)) {
87+
const body = context.payload.pull_request.body || "";
88+
if (body.includes(message)) {
8889
return;
8990
}
9091
await github.rest.pulls.update({
9192
owner: context.repo.owner,
9293
repo: context.repo.repo,
9394
pull_number: pullRequestNumber,
94-
body: (context.payload.pull_request.body || "") + "\n" + message
95+
body: body + "\n" + message
9596
});
9697
}
9798
}

0 commit comments

Comments
 (0)