update from master
This commit is contained in:
commit
66ac29059b
|
@ -1,17 +0,0 @@
|
|||
name: "Close stale issues"
|
||||
on:
|
||||
push: {}
|
||||
schedule:
|
||||
- cron: 0 * * * *
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
with:
|
||||
stale_age_days: 60
|
||||
wait_after_stale_days: 7
|
||||
max_operations_per_run: 30
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
15
README.md
15
README.md
|
@ -10,15 +10,14 @@ Basic:
|
|||
```
|
||||
name: "Close stale issues"
|
||||
on:
|
||||
push: {}
|
||||
schedule:
|
||||
- cron: 0 * * * *
|
||||
- cron: "0 * * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
- uses: actions/stale@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
|
||||
|
@ -29,15 +28,14 @@ Configure stale timeouts:
|
|||
```
|
||||
name: "Close stale issues"
|
||||
on:
|
||||
push: {}
|
||||
schedule:
|
||||
- cron: 0 * * * *
|
||||
- cron: "0 * * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
- uses: actions/stale@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
|
||||
|
@ -49,15 +47,14 @@ Configure labels:
|
|||
```
|
||||
name: "Close stale issues"
|
||||
on:
|
||||
push: {}
|
||||
schedule:
|
||||
- cron: 0 * * * *
|
||||
- cron: "0 * * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: bbq-beets/stale-bot@master
|
||||
- uses: actions/stale@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Stale issue message'
|
||||
|
|
|
@ -2,21 +2,6 @@
|
|||
|
||||
### Checkin
|
||||
|
||||
- Do checkin source (src)
|
||||
- Do checkin build output (lib)
|
||||
- Do checkin runtime node_modules
|
||||
- Do not checkin devDependency node_modules (husky can help see below)
|
||||
|
||||
### devDependencies
|
||||
|
||||
In order to handle correctly checking in node_modules without devDependencies, we run [Husky](https://github.com/typicode/husky) before each commit.
|
||||
This step ensures that formatting and checkin rules are followed and that devDependencies are excluded. To make sure Husky runs correctly, please use the following workflow:
|
||||
|
||||
```
|
||||
npm install # installs all devDependencies including Husky
|
||||
git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above)
|
||||
git commit -m "Informative commit message" # Commit. This will run Husky
|
||||
```
|
||||
|
||||
During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) as well as pruning out devDependencies using `npm prune --production`.
|
||||
It will also make sure these changes are appropriately included in your commit (no further work is needed)
|
||||
- Do check in source (src)
|
||||
- Do not check in build output (lib)
|
||||
- Do not check in node_modules
|
||||
|
|
10
lib/main.js
10
lib/main.js
|
@ -47,6 +47,10 @@ function processIssues(client, args, operationsLeft, page = 1) {
|
|||
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
|
||||
let isPr = !!issue.pull_request;
|
||||
let 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;
|
||||
if (isLabeledStale(issue, staleLabel)) {
|
||||
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
|
||||
|
@ -68,12 +72,12 @@ function processIssues(client, args, operationsLeft, page = 1) {
|
|||
});
|
||||
}
|
||||
function isLabeledStale(issue, label) {
|
||||
return issue.labels.filter(i => i.name === label).length > 0;
|
||||
const labelComparer = l => label.localeCompare(l.name, undefined, { sensitivity: 'accent' });
|
||||
return issue.labels.filter(labelComparer).length > 0;
|
||||
}
|
||||
function wasLastUpdatedBefore(issue, num_days) {
|
||||
const daysInMillis = 1000 * 60 * 60 * num_days;
|
||||
const millisSinceLastUpdated = new Date().getTime() - new Date(issue.updated_at).getTime();
|
||||
core.debug(`${daysInMillis}, ${millisSinceLastUpdated}`);
|
||||
return millisSinceLastUpdated >= daysInMillis;
|
||||
}
|
||||
function markStale(client, issue, staleMessage, staleLabel) {
|
||||
|
@ -110,7 +114,7 @@ function getAndValidateArgs() {
|
|||
const args = {
|
||||
repoToken: core.getInput('repo-token', { required: true }),
|
||||
staleIssueMessage: core.getInput('stale-issue-message'),
|
||||
stalePrMessage: core.getInput('stale-pr-message', { required: true }),
|
||||
stalePrMessage: core.getInput('stale-pr-message'),
|
||||
daysBeforeStale: parseInt(core.getInput('days-before-stale', { required: true })),
|
||||
daysBeforeClose: parseInt(core.getInput('days-before-close', { required: true })),
|
||||
staleIssueLabel: core.getInput('stale-issue-label', { required: true }),
|
||||
|
|
|
@ -628,9 +628,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.6.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.9.tgz",
|
||||
"integrity": "sha512-+YB9FtyxXGyD54p8rXwWaN1EWEyar5L58GlGWgtH2I9rGmLGBQcw63+0jw+ujqVavNuO47S1ByAjm9zdHMnskw==",
|
||||
"version": "12.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.0.tgz",
|
||||
"integrity": "sha512-vqcj1MVm2Sla4PpMfYKh1MyDN4D2f/mPIZD7RdAGqEsbE+JxfeqQHHVbRDQ0Nqn8i73gJa1HQ1Pu3+nH4Q0Yiw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
|
|
13
src/main.ts
13
src/main.ts
|
@ -48,7 +48,13 @@ async function processIssues(
|
|||
for (var issue of issues.data.values()) {
|
||||
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
|
||||
let isPr = !!issue.pull_request;
|
||||
|
||||
let 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;
|
||||
|
||||
if (isLabeledStale(issue, staleLabel)) {
|
||||
|
@ -80,7 +86,9 @@ function isLabeledStale(
|
|||
issue: Octokit.IssuesListForRepoResponseItem,
|
||||
label: string
|
||||
): boolean {
|
||||
return issue.labels.filter(i => i.name === label).length > 0;
|
||||
const labelComparer = l =>
|
||||
label.localeCompare(l.name, undefined, {sensitivity: 'accent'});
|
||||
return issue.labels.filter(labelComparer).length > 0;
|
||||
}
|
||||
|
||||
function wasLastUpdatedBefore(
|
||||
|
@ -90,7 +98,6 @@ function wasLastUpdatedBefore(
|
|||
const daysInMillis = 1000 * 60 * 60 * num_days;
|
||||
const millisSinceLastUpdated =
|
||||
new Date().getTime() - new Date(issue.updated_at).getTime();
|
||||
core.debug(`${daysInMillis}, ${millisSinceLastUpdated}`);
|
||||
return millisSinceLastUpdated >= daysInMillis;
|
||||
}
|
||||
|
||||
|
@ -139,7 +146,7 @@ function getAndValidateArgs(): Args {
|
|||
const args = {
|
||||
repoToken: core.getInput('repo-token', {required: true}),
|
||||
staleIssueMessage: core.getInput('stale-issue-message'),
|
||||
stalePrMessage: core.getInput('stale-pr-message', {required: true}),
|
||||
stalePrMessage: core.getInput('stale-pr-message'),
|
||||
daysBeforeStale: parseInt(
|
||||
core.getInput('days-before-stale', {required: true})
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue