Skip to content

Commit

Permalink
fix: Params - log pull_request params
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Feb 14, 2022
1 parent 2d0490f commit d0f7611
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,22 @@ export async function extractPullRequestParams(
let commitMessage;

if (includeCommitMessage) {
logger.debug(`Fetching commit message for '${repo.owner}/${repo.repo}#${pullRequest?.head?.sha}'`);

if (!token) {
logger.error('"token" input is required when "includeCommitMessage" is true');
} else {
const octokit = github.getOctokit(token);

commitMessage = await getGitHubCommitMessage({
octokit,
owner: repo.owner,
repo: repo.repo,
ref: pullRequest?.head?.sha,
});
try {
commitMessage = await getGitHubCommitMessage({
octokit,
owner: repo.owner,
repo: repo.repo,
ref: pullRequest?.head?.sha,
});
} catch (err) {
logger.error(`Error fetching commit data: ${err.message}`);
}
}
}

Expand Down

0 comments on commit d0f7611

Please sign in to comment.