mirror of
https://github.com/actions/stale.git
synced 2025-12-29 19:38:18 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af40726159 | ||
|
|
658139a1f1 | ||
|
|
707ba4d103 | ||
|
|
62b357a603 | ||
|
|
f75b3c75ce |
31
README.md
31
README.md
@@ -18,6 +18,31 @@ Run the tests :heavy_check_mark:
|
|||||||
```bash
|
```bash
|
||||||
$ npm test
|
$ npm test
|
||||||
```
|
```
|
||||||
|
### Arguments
|
||||||
|
|
||||||
|
| Input | Description | Usage |
|
||||||
|
| :---: | :---: | :---: |
|
||||||
|
| `repo-token` | PAT(Personal Access Token) for authorizing repository. | *Required* |
|
||||||
|
| `days-before-stale` | Idle number of days before marking an issue/pr as stale. *Defaults to **60*** | Optional
|
||||||
|
| `days-before-close` | Idle number of days before closing an stale issue/pr. *Defaults to **7*** | Optional
|
||||||
|
| `stale-issue-message` | Message to post on the stale issue. | Optional
|
||||||
|
| `stale-pr-message` | Message to post on the stale pr. | Optional
|
||||||
|
| `close-issue-message` | Message to post on the stale issue while closing it. | Optional
|
||||||
|
| `close-pr-message` | Message to post on the stale pr while closing it. | Optional
|
||||||
|
| `stale-issue-label` | Label to apply on the stale issue. *Defaults to **stale*** | Optional
|
||||||
|
| `close-issue-label` | Label to apply on closing issue. | Optional
|
||||||
|
| `stale-pr-label` | Label to apply on the stale pr. | Optional
|
||||||
|
| `close-pr-label` | Label to apply on the closing pr. | Optional
|
||||||
|
| `exempt-issue-labels` | Labels on an issue exempted from being marked as stale. | Optional
|
||||||
|
| `exempt-pr-labels` | Labels on the pr exempted from being marked as stale. | Optional
|
||||||
|
| `only-labels` | Only labels checked for stale issue/pr. | Optional
|
||||||
|
| `operations-per-run` | Maximum number of operations per run. *Defaults to **30*** | Optional
|
||||||
|
| `remove-stale-when-updated` | Remove stale label from issue/pr on updates or comments. *Defaults to **true*** | Optional
|
||||||
|
| `debug-only` | Dry-run on action. *Defaults to **false*** | Optional
|
||||||
|
| `ascending` | Order to get issues/pr. *Defaults to **false*** | Optional
|
||||||
|
| `skip-stale-issue-message` | Skip adding stale message on stale issue. *Defaults to **false*** | Optional
|
||||||
|
| `skip-stale-pr-message` | Skip adding stale message on stale pr. *Defaults to **false*** | Optional
|
||||||
|
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
@@ -28,7 +53,7 @@ Basic:
|
|||||||
name: "Close stale issues"
|
name: "Close stale issues"
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "30 1 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
@@ -46,7 +71,7 @@ Configure stale timeouts:
|
|||||||
name: "Close stale issues"
|
name: "Close stale issues"
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "30 1 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
@@ -65,7 +90,7 @@ Configure labels:
|
|||||||
name: "Close stale issues"
|
name: "Close stale issues"
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "30 1 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
|
|||||||
12
dist/index.js
vendored
12
dist/index.js
vendored
@@ -75,7 +75,7 @@ class IssueProcessor {
|
|||||||
}
|
}
|
||||||
for (const issue of issues.values()) {
|
for (const issue of issues.values()) {
|
||||||
const isPr = !!issue.pull_request;
|
const isPr = !!issue.pull_request;
|
||||||
core.info(`Found issue: issue #${issue.number} - ${issue.title} last updated ${issue.updated_at} (is pr? ${isPr})`);
|
core.info(`Found issue: issue #${issue.number} last updated ${issue.updated_at} (is pr? ${isPr})`);
|
||||||
// calculate string based messages for this issue
|
// calculate string based messages for this issue
|
||||||
const staleMessage = isPr
|
const staleMessage = isPr
|
||||||
? this.options.stalePrMessage
|
? this.options.stalePrMessage
|
||||||
@@ -172,7 +172,7 @@ class IssueProcessor {
|
|||||||
// find any comments since the date
|
// find any comments since the date
|
||||||
const comments = yield this.listIssueComments(issue.number, sinceDate);
|
const comments = yield this.listIssueComments(issue.number, sinceDate);
|
||||||
const filteredComments = comments.filter(comment => comment.user.type === 'User' && comment.user.login !== github_1.context.actor);
|
const filteredComments = comments.filter(comment => comment.user.type === 'User' && comment.user.login !== github_1.context.actor);
|
||||||
core.info(`Comments not made by ${github_1.context.actor} or another bot: ${filteredComments.length}`);
|
core.info(`Comments not made by actor or another bot: ${filteredComments.length}`);
|
||||||
// if there are any user comments returned
|
// if there are any user comments returned
|
||||||
return filteredComments.length > 0;
|
return filteredComments.length > 0;
|
||||||
});
|
});
|
||||||
@@ -222,7 +222,7 @@ class IssueProcessor {
|
|||||||
// Mark an issue as stale with a comment and a label
|
// Mark an issue as stale with a comment and a label
|
||||||
markStale(issue, staleMessage, staleLabel, skipMessage) {
|
markStale(issue, staleMessage, staleLabel, skipMessage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info(`Marking issue #${issue.number} - ${issue.title} as stale`);
|
core.info(`Marking issue #${issue.number} as stale`);
|
||||||
this.staleIssues.push(issue);
|
this.staleIssues.push(issue);
|
||||||
this.operationsLeft -= 2;
|
this.operationsLeft -= 2;
|
||||||
// if the issue is being marked stale, the updated date should be changed to right now
|
// if the issue is being marked stale, the updated date should be changed to right now
|
||||||
@@ -261,7 +261,7 @@ class IssueProcessor {
|
|||||||
// Close an issue based on staleness
|
// Close an issue based on staleness
|
||||||
closeIssue(issue, closeMessage, closeLabel) {
|
closeIssue(issue, closeMessage, closeLabel) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info(`Closing issue #${issue.number} - ${issue.title} for being stale`);
|
core.info(`Closing issue #${issue.number} for being stale`);
|
||||||
this.closedIssues.push(issue);
|
this.closedIssues.push(issue);
|
||||||
this.operationsLeft -= 1;
|
this.operationsLeft -= 1;
|
||||||
if (this.options.debugOnly) {
|
if (this.options.debugOnly) {
|
||||||
@@ -309,7 +309,7 @@ class IssueProcessor {
|
|||||||
// Remove a label from an issue
|
// Remove a label from an issue
|
||||||
removeLabel(issue, label) {
|
removeLabel(issue, label) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info(`Removing label ${label} from issue #${issue.number} - ${issue.title}`);
|
core.info(`Removing label from issue #${issue.number}`);
|
||||||
this.removedLabelIssues.push(issue);
|
this.removedLabelIssues.push(issue);
|
||||||
this.operationsLeft -= 1;
|
this.operationsLeft -= 1;
|
||||||
if (this.options.debugOnly) {
|
if (this.options.debugOnly) {
|
||||||
@@ -332,7 +332,7 @@ class IssueProcessor {
|
|||||||
///see https://developer.github.com/v3/activity/events/
|
///see https://developer.github.com/v3/activity/events/
|
||||||
getLabelCreationDate(issue, label) {
|
getLabelCreationDate(issue, label) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info(`Checking for label ${label} on issue #${issue.number}`);
|
core.info(`Checking for label on issue #${issue.number}`);
|
||||||
this.operationsLeft -= 1;
|
this.operationsLeft -= 1;
|
||||||
const options = this.client.issues.listEvents.endpoint.merge({
|
const options = this.client.issues.listEvents.endpoint.merge({
|
||||||
owner: github_1.context.repo.owner,
|
owner: github_1.context.repo.owner,
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export class IssueProcessor {
|
|||||||
const isPr = !!issue.pull_request;
|
const isPr = !!issue.pull_request;
|
||||||
|
|
||||||
core.info(
|
core.info(
|
||||||
`Found issue: issue #${issue.number} - ${issue.title} last updated ${issue.updated_at} (is pr? ${isPr})`
|
`Found issue: issue #${issue.number} last updated ${issue.updated_at} (is pr? ${isPr})`
|
||||||
);
|
);
|
||||||
|
|
||||||
// calculate string based messages for this issue
|
// calculate string based messages for this issue
|
||||||
@@ -277,7 +277,7 @@ export class IssueProcessor {
|
|||||||
);
|
);
|
||||||
|
|
||||||
core.info(
|
core.info(
|
||||||
`Comments not made by ${context.actor} or another bot: ${filteredComments.length}`
|
`Comments not made by actor or another bot: ${filteredComments.length}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// if there are any user comments returned
|
// if there are any user comments returned
|
||||||
@@ -336,7 +336,7 @@ export class IssueProcessor {
|
|||||||
staleLabel: string,
|
staleLabel: string,
|
||||||
skipMessage: boolean
|
skipMessage: boolean
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
core.info(`Marking issue #${issue.number} - ${issue.title} as stale`);
|
core.info(`Marking issue #${issue.number} as stale`);
|
||||||
|
|
||||||
this.staleIssues.push(issue);
|
this.staleIssues.push(issue);
|
||||||
|
|
||||||
@@ -382,9 +382,7 @@ export class IssueProcessor {
|
|||||||
closeMessage?: string,
|
closeMessage?: string,
|
||||||
closeLabel?: string
|
closeLabel?: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
core.info(
|
core.info(`Closing issue #${issue.number} for being stale`);
|
||||||
`Closing issue #${issue.number} - ${issue.title} for being stale`
|
|
||||||
);
|
|
||||||
|
|
||||||
this.closedIssues.push(issue);
|
this.closedIssues.push(issue);
|
||||||
|
|
||||||
@@ -434,9 +432,7 @@ export class IssueProcessor {
|
|||||||
|
|
||||||
// Remove a label from an issue
|
// Remove a label from an issue
|
||||||
private async removeLabel(issue: Issue, label: string): Promise<void> {
|
private async removeLabel(issue: Issue, label: string): Promise<void> {
|
||||||
core.info(
|
core.info(`Removing label from issue #${issue.number}`);
|
||||||
`Removing label ${label} from issue #${issue.number} - ${issue.title}`
|
|
||||||
);
|
|
||||||
|
|
||||||
this.removedLabelIssues.push(issue);
|
this.removedLabelIssues.push(issue);
|
||||||
|
|
||||||
@@ -464,7 +460,7 @@ export class IssueProcessor {
|
|||||||
issue: Issue,
|
issue: Issue,
|
||||||
label: string
|
label: string
|
||||||
): Promise<string | undefined> {
|
): Promise<string | undefined> {
|
||||||
core.info(`Checking for label ${label} on issue #${issue.number}`);
|
core.info(`Checking for label on issue #${issue.number}`);
|
||||||
|
|
||||||
this.operationsLeft -= 1;
|
this.operationsLeft -= 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user