Skip to content

Commit

Permalink
bug: log required missing labels
Browse files Browse the repository at this point in the history
  • Loading branch information
djzager committed Jun 30, 2022
1 parent 9039c75 commit 9522461
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
7 changes: 5 additions & 2 deletions lib/actions/reconcile-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ async function reconcileIssue() {
jiraBaseUrl: core.getInput("jiraBaseUrl", { required: true }),
jiraToken: core.getInput("jiraToken", { required: true }),
jiraProject: core.getInput("jiraProject", { required: true }),
requireMissingLabels: core.getInput("requireMissingLabels", { required: true }).split(","),
requireMissingLabels: core
.getInput("requireMissingLabels", { required: true })
.split(",")
.map((element) => element.trim()),
additionalLabels: core.getInput("additionalLabels").split(","),
};
// First, make sure we are looking at the right thing.
Expand Down Expand Up @@ -92,7 +95,7 @@ async function reconcileIssue() {
}
const requiredMissingLabels = inputs.requireMissingLabels.filter((label) => ghIssue.hasLabel(label));
if (requiredMissingLabels) {
core.info(`This issue has ${requiredMissingLabels} that indicate this issue is not triaged.`);
core.warning(`This issue has ${requiredMissingLabels} that indicate this issue is not triaged.`);
return;
}
// jiraIssueParams are the primary fields we are concerned with updating
Expand Down
4 changes: 1 addition & 3 deletions lib/github-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ class GitHubIssue {
});
}
hasLabel(label) {
const labels = this.getLabels();
core.debug(`Looking for label ${label} in ${labels}`);
return labels.includes(label);
return this.getLabels().includes(label);
}
hasLabelRegexp(regexp) {
const labels = this.getLabels();
Expand Down
15 changes: 11 additions & 4 deletions src/actions/reconcile-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ async function reconcileIssue() {
jiraBaseUrl: core.getInput("jiraBaseUrl", { required: true }),
jiraToken: core.getInput("jiraToken", { required: true }),
jiraProject: core.getInput("jiraProject", { required: true }),
requireMissingLabels: core.getInput("requireMissingLabels", { required: true }).split(","),
requireMissingLabels: core
.getInput("requireMissingLabels", { required: true })
.split(",")
.map((element) => element.trim()),
additionalLabels: core.getInput("additionalLabels").split(","),
};

Expand Down Expand Up @@ -81,10 +84,14 @@ async function reconcileIssue() {
return;
}

const requiredMissingLabels = inputs.requireMissingLabels.filter((label) => ghIssue.hasLabel(label));
const requiredMissingLabels = inputs.requireMissingLabels.filter((label) =>
ghIssue.hasLabel(label)
);
if (requiredMissingLabels) {
core.info(`This issue has ${requiredMissingLabels} that indicate this issue is not triaged.`);
return
core.warning(
`This issue has ${requiredMissingLabels} that indicate this issue is not triaged.`
);
return;
}

// jiraIssueParams are the primary fields we are concerned with updating
Expand Down
5 changes: 1 addition & 4 deletions src/github-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class GitHubIssue {
});
}


// addComment creates a comment with ${body}
async addComment(body: string) {
await github.getOctokit(this.token).rest.issues.createComment({
Expand All @@ -121,9 +120,7 @@ class GitHubIssue {
}

hasLabel(label: string): boolean {
const labels = this.getLabels();
core.debug(`Looking for label ${label} in ${labels}`);
return labels.includes(label);
return this.getLabels().includes(label);
}

hasLabelRegexp(regexp: RegExp): boolean {
Expand Down

0 comments on commit 9522461

Please sign in to comment.