Skip to content

Commit

Permalink
fix: use correct event payload property
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jul 7, 2023
1 parent 59bd076 commit f2e4605
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions main.js
@@ -1,10 +1,12 @@
// @ts-check

/**
*
* @param {core} core
* @param {import("@octokit/webhooks-types").ReleaseCreatedEvent} event
* @param {import("@actions/core")} core
* @param {{client_payload: import("@octokit/webhooks-types").ReleaseCreatedEvent}} event
*/
export function main(core, event) {
const body = event.release.body;
const body = event.client_payload.release.body;

// get separate changelogs
const [ignore_, ...changelogs] = body.split(/^- /gm);
Expand All @@ -15,7 +17,7 @@ export function main(core, event) {
const lines = changelog.split(/\n\s*/).filter(Boolean);

const lastLine = lines.at(-1);
if (!lastLine.startsWith("<!-- Changed components:")) {
if (!lastLine?.startsWith("<!-- Changed components:")) {
// ignore changes that didn'd affect any components
continue;
}
Expand Down
1 change: 0 additions & 1 deletion run.js
Expand Up @@ -3,7 +3,6 @@ import core from "@actions/core";

import { main } from "./main.js";

/** @type {import("@octokit/webhooks-types").ReleaseCreatedEvent} */
const event = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, "utf8"));

main(core, event);

0 comments on commit f2e4605

Please sign in to comment.