Cleanup release (#42)

Fix up the release pipeline, add linting and clean up a bit.
This commit is contained in:
Ross Brodbeck
2020-04-14 13:28:00 -04:00
committed by GitHub
parent d179b42b05
commit 60b5a6b134
13 changed files with 28265 additions and 1533 deletions

View File

@@ -1,11 +1,11 @@
import * as core from '@actions/core';
import * as github from '@actions/github';
import * as Octokit from '@octokit/rest';
import {Octokit} from '@octokit/rest';
type Issue = Octokit.IssuesListForRepoResponseItem;
type IssueLabel = Octokit.IssuesListForRepoResponseItemLabelsItem;
type Args = {
interface Args {
repoToken: string;
staleIssueMessage: string;
stalePrMessage: string;
@@ -17,9 +17,9 @@ type Args = {
exemptPrLabel: string;
onlyLabels: string;
operationsPerRun: number;
};
}
async function run() {
async function run(): Promise<void> {
try {
const args = getAndValidateArgs();
@@ -43,7 +43,7 @@ async function processIssues(
state: 'open',
labels: args.onlyLabels,
per_page: 100,
page: page
page
});
operationsLeft -= 1;
@@ -52,23 +52,26 @@ async function processIssues(
return operationsLeft;
}
for (var issue of issues.data.values()) {
for (const issue of issues.data.values()) {
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
let isPr = !!issue.pull_request;
const isPr = !!issue.pull_request;
let staleMessage = isPr ? args.stalePrMessage : args.staleIssueMessage;
const staleMessage = isPr ? args.stalePrMessage : args.staleIssueMessage;
if (!staleMessage) {
core.debug(`skipping ${isPr ? 'pr' : 'issue'} due to empty message`);
continue;
}
let staleLabel = isPr ? args.stalePrLabel : args.staleIssueLabel;
let exemptLabel = isPr ? args.exemptPrLabel : args.exemptIssueLabel;
const staleLabel = isPr ? args.stalePrLabel : args.staleIssueLabel;
const exemptLabel = isPr ? args.exemptPrLabel : args.exemptIssueLabel;
if (exemptLabel && isLabeled(issue, exemptLabel)) {
continue;
} else if (isLabeled(issue, staleLabel)) {
if (args.daysBeforeClose >= 0 && wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
if (
args.daysBeforeClose >= 0 &&
wasLastUpdatedBefore(issue, args.daysBeforeClose)
) {
operationsLeft -= await closeIssue(client, issue);
} else {
continue;
@@ -167,7 +170,7 @@ function getAndValidateArgs(): Args {
)
};
for (var numberInput of [
for (const numberInput of [
'days-before-stale',
'days-before-close',
'operations-per-run'