mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
* Initial implementation * Fix * fix * fix * Make it look nicer * Update docs * Rename to pr-status-comment * Remove outputs * Update path * update name * Checkout PR in a detached worktree (#626) Co-authored-by: bluwy <bjornlu.dev@gmail.com> * Move comment to separate job * Loosen event requirement * Update * Apply suggestions from code review Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Use TLA * use using * Remove test log --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
24 lines
607 B
TypeScript
24 lines
607 B
TypeScript
import * as core from "@actions/core";
|
|
import * as github from "@actions/github";
|
|
import { getCommentMessage } from "./message.ts";
|
|
|
|
try {
|
|
await main();
|
|
} catch (err) {
|
|
core.setFailed((err as Error).message);
|
|
}
|
|
|
|
async function main() {
|
|
const context = github.context.payload.pull_request;
|
|
if (!context) {
|
|
throw new Error(
|
|
"This action should only be run on `pull_request_target` or `pull_request` events",
|
|
);
|
|
}
|
|
|
|
core.info("Creating comment message...");
|
|
const commentBody = await getCommentMessage(context);
|
|
core.setOutput("comment-body", commentBody);
|
|
core.info("Done!");
|
|
}
|