Skip to content

Commit

Permalink
default to 0 if context.issue.number is absent
Browse files Browse the repository at this point in the history
Big thanks to @p4perf4ce for contributing.
  • Loading branch information
rdhar authored Aug 9, 2024
1 parent b5cf0a4 commit 7539f4e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ module.exports = async ({ context, core, exec, github }) => {
const fmt_result_limit = 6e3;

// Get PR number from event trigger for unique identifier.
let pr_number = '0';
if (context.eventName === "pull_request") {
pr_number = context.issue.number;
} else if (context.eventName === "push") {
let pr_number;
if (context.eventName === "push") {
const { data: list_prs_of_commit } =
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
Expand All @@ -23,7 +21,7 @@ module.exports = async ({ context, core, exec, github }) => {
} else if (context.eventName === "merge_group") {
pr_number = parseInt(context.ref.split("/pr-")[1]);
} else {
pr_number = context.issue.number;
pr_number = context.issue.number || 0;
}

// Check for Tofu CLI path.
Expand Down

0 comments on commit 7539f4e

Please sign in to comment.