Skip to content

Commit

Permalink
ci: use passed in issue number
Browse files Browse the repository at this point in the history
  • Loading branch information
tlvince committed Dec 21, 2023
1 parent 11dbf4c commit 0d038dc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/scripts/comment.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = async ({ github, context, header, body, issueNumber }) => {
const comment = [header, body].join("\n");
const issue_number = issueNumber || context.issue.number;

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber || context.issue.number,
issue_number,
});

const botComment = comments.find(
Expand All @@ -13,14 +13,13 @@ module.exports = async ({ github, context, header, body, issueNumber }) => {
comment.user.id === 41898282 && comment.body.startsWith(header),
);

const comment = [header, body].join("\n");
const commentFn = botComment ? "updateComment" : "createComment";

await github.rest.issues[commentFn]({
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
...(botComment
? { comment_id: botComment.id }
: { issue_number: context.payload.number }),
...(botComment ? { comment_id: botComment.id } : { issue_number }),
});
};

0 comments on commit 0d038dc

Please sign in to comment.