Skip to content

Commit

Permalink
refactor: add logs (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyang authored Jan 7, 2023
1 parent 91f384e commit ac67447
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ async function run() {
const token = core.getInput("github-token", { required: true });
const octokit = github.getOctokit(token);
const labelNames = await getPullRequestLabelNames(octokit);
core.debug(`PR label names: ${labelNames}`);
const labels = getInputLabels();
core.debug(`Input labels: ${labels}`);
const result = labels.every((label) => labelNames.findIndex((value) => label === value) >= 0);
core.setOutput("result", result);
core.debug("End");
Expand All @@ -54,6 +56,7 @@ async function getPullRequestLabelNames(octokit) {
});
core.debug(`Retrieved commit data: ${response.data}`);
const pr = response.data.length > 0 && response.data[0];
core.debug(`Retrieved PR: ${pr}`);
return pr ? pr.labels.map((label) => label.name || "") : [];
}
function getInputLabels() {
Expand Down

0 comments on commit ac67447

Please sign in to comment.