bugfix for case insensitive issues
This commit is contained in:
parent
f9ffc05520
commit
1acc1d62d9
15
src/main.ts
15
src/main.ts
|
@ -2,6 +2,9 @@ import * as core from '@actions/core';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import * as Octokit from '@octokit/rest';
|
import * as Octokit from '@octokit/rest';
|
||||||
|
|
||||||
|
type Issue = Octokit.IssuesListForRepoResponseItem;
|
||||||
|
type IssueLabels = Octokit.IssuesListForRepoResponseItemLabelsItem;
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
repoToken: string;
|
repoToken: string;
|
||||||
staleIssueMessage: string;
|
staleIssueMessage: string;
|
||||||
|
@ -83,16 +86,16 @@ async function processIssues(
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLabeledStale(
|
function isLabeledStale(
|
||||||
issue: Octokit.IssuesListForRepoResponseItem,
|
issue: Issue,
|
||||||
label: string
|
label: string
|
||||||
): boolean {
|
): boolean {
|
||||||
const labelComparer = l =>
|
const labelComparer : (l: IssueLabels) => boolean = l =>
|
||||||
label.localeCompare(l.name, undefined, {sensitivity: 'accent'});
|
label.localeCompare(l.name, undefined, {sensitivity: 'accent'}) === 0;
|
||||||
return issue.labels.filter(labelComparer).length > 0;
|
return issue.labels.filter(labelComparer).length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function wasLastUpdatedBefore(
|
function wasLastUpdatedBefore(
|
||||||
issue: Octokit.IssuesListForRepoResponseItem,
|
issue: Issue,
|
||||||
num_days: number
|
num_days: number
|
||||||
): boolean {
|
): boolean {
|
||||||
const daysInMillis = 1000 * 60 * 60 * num_days;
|
const daysInMillis = 1000 * 60 * 60 * num_days;
|
||||||
|
@ -103,7 +106,7 @@ function wasLastUpdatedBefore(
|
||||||
|
|
||||||
async function markStale(
|
async function markStale(
|
||||||
client: github.GitHub,
|
client: github.GitHub,
|
||||||
issue: Octokit.IssuesListForRepoResponseItem,
|
issue: Issue,
|
||||||
staleMessage: string,
|
staleMessage: string,
|
||||||
staleLabel: string
|
staleLabel: string
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
|
@ -128,7 +131,7 @@ async function markStale(
|
||||||
|
|
||||||
async function closeIssue(
|
async function closeIssue(
|
||||||
client: github.GitHub,
|
client: github.GitHub,
|
||||||
issue: Octokit.IssuesListForRepoResponseItem
|
issue: Issue
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
core.debug(`closing issue ${issue.title} for being stale`);
|
core.debug(`closing issue ${issue.title} for being stale`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue