Skip to content

Commit

Permalink
Added support for pull request comment (aka issue comment) event (#2738)
Browse files Browse the repository at this point in the history
* Fixed ship workflow YAML

* Simplified preversion script

* Added support for pull request comment (aka issue comment) event
  • Loading branch information
CatChen authored May 28, 2024
1 parent 05eed37 commit 3c6e0fd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { components } from '@octokit/openapi-types/types';
import type {
CheckRunEvent,
CheckSuiteEvent,
IssueCommentEvent,
PullRequestEvent,
PullRequestReviewEvent,
WorkflowRunEvent,
Expand Down Expand Up @@ -330,6 +331,14 @@ async function run(): Promise<void> {
await handlePullRequest(pullRequest.number);
})();
break;
case 'issue_comment':
await (async () => {
const issue = (context.payload as IssueCommentEvent).issue;
if (issue.pull_request !== undefined) {
await handlePullRequest(issue.number);
}
})();
break;
case 'check_run':
await (async () => {
const checkRun = (context.payload as CheckRunEvent).check_run;
Expand All @@ -344,7 +353,7 @@ async function run(): Promise<void> {
await handlePullRequest(pullRequest.number);
}
})();
return;
break;
case 'check_suite':
await (async () => {
const checkSuites = (context.payload as CheckSuiteEvent).check_suite;
Expand All @@ -359,7 +368,7 @@ async function run(): Promise<void> {
await handlePullRequest(pullRequest.number);
}
})();
return;
break;
case 'workflow_run':
await (async () => {
const workflowRun = (context.payload as WorkflowRunEvent).workflow_run;
Expand All @@ -378,7 +387,7 @@ async function run(): Promise<void> {
case 'workflow_dispatch':
default:
error(`Unsupported GitHub Action event: ${context.eventName}`);
return;
break;
}
}

Expand Down

0 comments on commit 3c6e0fd

Please sign in to comment.