Fix for logging error types instead of strings in the main try/catch (#66)
* Bump actions core for more lenient command inputs * Fix issue with issues that are old and unlabeled
This commit is contained in:
parent
e611bf905b
commit
71d46bfe23
File diff suppressed because it is too large
Load Diff
|
@ -5,53 +5,18 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
|
||||||
"integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
|
"integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
|
||||||
},
|
},
|
||||||
"@actions/github": {
|
"@actions/github": {
|
||||||
"version": "2.1.1",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/github/-/github-2.2.0.tgz",
|
||||||
"integrity": "sha512-kAgTGUx7yf5KQCndVeHSwCNZuDBvPyxm5xKTswW2lofugeuC1AZX73nUUVDNaysnM9aKFMHv9YCdVJbg7syEyA==",
|
"integrity": "sha512-9UAZqn8ywdR70n3GwVle4N8ALosQs4z50N7XMXrSTUVOmVpaBC5kE3TRTT7qQdi3OaQV24mjGuJZsHUmhD+ZXw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^1.0.3",
|
"@actions/http-client": "^1.0.3",
|
||||||
"@octokit/graphql": "^4.3.1",
|
"@octokit/graphql": "^4.3.1",
|
||||||
"@octokit/rest": "^16.43.1"
|
"@octokit/rest": "^16.43.1"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/request-error": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/types": "^2.0.0",
|
|
||||||
"deprecation": "^2.0.0",
|
|
||||||
"once": "^1.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@octokit/rest": {
|
|
||||||
"version": "16.43.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz",
|
|
||||||
"integrity": "sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/auth-token": "^2.4.0",
|
|
||||||
"@octokit/plugin-paginate-rest": "^1.1.1",
|
|
||||||
"@octokit/plugin-request-log": "^1.0.0",
|
|
||||||
"@octokit/plugin-rest-endpoint-methods": "2.4.0",
|
|
||||||
"@octokit/request": "^5.2.0",
|
|
||||||
"@octokit/request-error": "^1.0.2",
|
|
||||||
"atob-lite": "^2.0.0",
|
|
||||||
"before-after-hook": "^2.0.0",
|
|
||||||
"btoa-lite": "^1.0.0",
|
|
||||||
"deprecation": "^2.0.0",
|
|
||||||
"lodash.get": "^4.4.2",
|
|
||||||
"lodash.set": "^4.3.2",
|
|
||||||
"lodash.uniq": "^4.5.0",
|
|
||||||
"octokit-pagination-methods": "^1.1.0",
|
|
||||||
"once": "^1.4.0",
|
|
||||||
"universal-user-agent": "^4.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/http-client": {
|
"@actions/http-client": {
|
||||||
|
@ -557,13 +522,23 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/graphql": {
|
"@octokit/graphql": {
|
||||||
"version": "4.3.1",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.4.0.tgz",
|
||||||
"integrity": "sha512-hCdTjfvrK+ilU2keAdqNBWOk+gm1kai1ZcdjRfB30oA3/T6n53UVJb7w0L5cR3/rhU91xT3HSqCd+qbvH06yxA==",
|
"integrity": "sha512-Du3hAaSROQ8EatmYoSAJjzAz3t79t9Opj/WY1zUgxVUGfIKn0AEjg+hlOLscF6fv6i/4y/CeUvsWgIfwMkTccw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/request": "^5.3.0",
|
"@octokit/request": "^5.3.0",
|
||||||
"@octokit/types": "^2.0.0",
|
"@octokit/types": "^2.0.0",
|
||||||
"universal-user-agent": "^4.0.0"
|
"universal-user-agent": "^5.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"universal-user-agent": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==",
|
||||||
|
"requires": {
|
||||||
|
"os-name": "^3.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/plugin-paginate-rest": {
|
"@octokit/plugin-paginate-rest": {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.3",
|
"@actions/core": "^1.2.4",
|
||||||
"@actions/github": "^2.2.0",
|
"@actions/github": "^2.2.0",
|
||||||
"@octokit/rest": "^16.43.1",
|
"@octokit/rest": "^16.43.1",
|
||||||
"semver": "^6.1.1"
|
"semver": "^6.1.1"
|
||||||
|
|
|
@ -67,7 +67,7 @@ export class IssueProcessor {
|
||||||
issueNumber: number,
|
issueNumber: number,
|
||||||
sinceDate: string
|
sinceDate: string
|
||||||
) => Promise<Comment[]>,
|
) => Promise<Comment[]>,
|
||||||
getLabelCreationDate?: (issue: Issue, label: string) => Promise<string>
|
getLabelCreationDate?: (issue: Issue, label: string) => Promise<string | undefined>
|
||||||
) {
|
) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.operationsLeft = options.operationsPerRun;
|
this.operationsLeft = options.operationsPerRun;
|
||||||
|
@ -190,25 +190,27 @@ export class IssueProcessor {
|
||||||
return; // nothing to do because we aren't closing stale issues
|
return; // nothing to do because we aren't closing stale issues
|
||||||
}
|
}
|
||||||
|
|
||||||
const markedStaleOn: string = await this.getLabelCreationDate(
|
const markedStaleOn: string | undefined = await this.getLabelCreationDate(
|
||||||
issue,
|
issue,
|
||||||
staleLabel
|
staleLabel
|
||||||
);
|
);
|
||||||
const issueHasComments: boolean = await this.isIssueStillStale(
|
const issueHasComments: boolean = await this.isIssueStillStale(
|
||||||
issue,
|
issue,
|
||||||
markedStaleOn
|
markedStaleOn || issue.updated_at
|
||||||
);
|
);
|
||||||
|
|
||||||
const issueHasUpdate: boolean = IssueProcessor.updatedSince(
|
const issueHasUpdate: boolean = IssueProcessor.updatedSince(
|
||||||
issue.updated_at,
|
issue.updated_at,
|
||||||
this.options.daysBeforeClose
|
this.options.daysBeforeClose
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (markedStaleOn) {
|
||||||
core.debug(`Issue #${issue.number} marked stale on: ${markedStaleOn}`);
|
core.debug(`Issue #${issue.number} marked stale on: ${markedStaleOn}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug(`Issue #${issue.number} is not marked stale, but last update of ${issue.updated_at} is older than ${this.options.daysBeforeStale} days`);
|
||||||
|
}
|
||||||
core.debug(`Issue #${issue.number} has been updated: ${issueHasUpdate}`);
|
core.debug(`Issue #${issue.number} has been updated: ${issueHasUpdate}`);
|
||||||
core.debug(
|
core.debug(`Issue #${issue.number} has been commented on: ${issueHasComments}`);
|
||||||
`Issue #${issue.number} has been commented on: ${issueHasComments}`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!issueHasComments && !issueHasUpdate) {
|
if (!issueHasComments && !issueHasUpdate) {
|
||||||
core.debug(
|
core.debug(
|
||||||
|
@ -219,7 +221,7 @@ export class IssueProcessor {
|
||||||
if (this.options.removeStaleWhenUpdated) {
|
if (this.options.removeStaleWhenUpdated) {
|
||||||
await this.removeLabel(issue, staleLabel);
|
await this.removeLabel(issue, staleLabel);
|
||||||
}
|
}
|
||||||
core.debug(`Ignoring stale ${issueType} because it was updated recenlty`);
|
core.debug(`Ignoring stale ${issueType} because it was updated recently`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +357,7 @@ export class IssueProcessor {
|
||||||
private async getLabelCreationDate(
|
private async getLabelCreationDate(
|
||||||
issue: Issue,
|
issue: Issue,
|
||||||
label: string
|
label: string
|
||||||
): Promise<string> {
|
): Promise<string | undefined> {
|
||||||
core.debug(`Checking for label ${label} on issue #${issue.number}`);
|
core.debug(`Checking for label ${label} on issue #${issue.number}`);
|
||||||
|
|
||||||
this.operationsLeft -= 1;
|
this.operationsLeft -= 1;
|
||||||
|
@ -374,7 +376,12 @@ export class IssueProcessor {
|
||||||
event => event.event === 'labeled' && event.label.name === label
|
event => event.event === 'labeled' && event.label.name === label
|
||||||
);
|
);
|
||||||
|
|
||||||
return staleLabeledEvent!.created_at;
|
if (!staleLabeledEvent) {
|
||||||
|
// Must be old rather than labeled
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return staleLabeledEvent.created_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static isLabeled(issue: Issue, label: string): boolean {
|
private static isLabeled(issue: Issue, label: string): boolean {
|
||||||
|
|
Loading…
Reference in New Issue