GitHub
githubEventsから、導入したパッケージの対応イベントとactionの一覧を取得できます。JSON形式の配信に対応しています。Issue・Pull Requestのタイトル、本文、状態、作成者、ブランチ情報などに省略可能な型があり、その他はunknownです。型による業務データの実行時検証は行いません。対応範囲のJSONにパッケージバージョンと形式を載せています。
ts
import { Hibiki } from "@hibiki-js/core"
import { github } from "@hibiki-js/github"
const app = new Hibiki().use(github({
secret: process.env.GITHUB_WEBHOOK_SECRET!,
}))受け付けるのは application/json のみです。その他の GitHub イベントはデフォルトで 200(strictEvents: true なら 400)です。
対応イベント
pushpingcreatedeletepull_request.openedpull_request.closedpull_request.reopenedpull_request.synchronizepull_request.ready_for_reviewpull_request.labeledpull_request_review.submittedissues.openedissues.closedissues.reopenedissue_comment.createdrelease.publishedworkflow_run.completedworkflow_job.completedcheck_suite.completedcheck_run.completeddeployment.createddeployment_status.created
ハンドラは github. プレフィックスを使います。
ts
app.on("github.pull_request.opened", async ({ event }) => {
console.log(event.pull_request.number, event.repository.full_name)
})オプションと型の詳細は API リファレンス を参照してください。
