Skip to content

Commit

Permalink
fix: don't error if event is not push
Browse files Browse the repository at this point in the history
Assert `commits` array exists only AFTER confirming that event is
`push`. If event is not `push`, print warning and exit 0.
  • Loading branch information
tmillr committed Nov 30, 2022
1 parent c1ce6e1 commit 1a52a5c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ try {
const name = repo.repo;
const octokit = getOctokit();

if (eventName !== "push") {
core.warning(`This action only works with "push" events`, {
title: `Unsupported Event "${eventName}"`,
});

process.exit(0);
}

const commits = (() => {
const ret = payload.commits;
assert(ret !== undefined, 'missing "commits" field of event payload ');
Expand All @@ -33,14 +41,6 @@ try {

/*** Begin Validation ***/

if (eventName !== "push") {
core.warning(`This action only works with "push" events`, {
title: `Unsupported Event "${eventName}"`,
});

process.exit(0);
}

let issueNumber = core.getInput("issueNumber", {
required: false,
trimWhitespace: true,
Expand Down

0 comments on commit 1a52a5c

Please sign in to comment.