Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Boop
4c70ce65b6 Update references to v5 2022-03-01 12:09:34 -05:00
27 changed files with 996 additions and 3361 deletions

View File

@@ -4,11 +4,6 @@ updates:
- package-ecosystem: 'npm' - package-ecosystem: 'npm'
# Look for `package.json` and `lock` files in the `root` directory # Look for `package.json` and `lock` files in the `root` directory
directory: '/' directory: '/'
# Check the npm registry for updates once a week (Monday) # Check the npm registry for updates every day (weekdays)
schedule: schedule:
interval: 'weekly' interval: 'daily'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'

View File

@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Set Node.js 16.x - name: Set Node.js 16.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
@@ -46,7 +46,7 @@ jobs:
id: diff id: diff
# If index.js was different than expected, upload the expected version as an artifact # If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }} if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with: with:
name: dist name: dist

View File

@@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v2
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v1
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v2 uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v1

View File

@@ -10,14 +10,14 @@ jobs:
build: # make sure build/ci work properly build: # make sure build/ci work properly
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- run: | - run: |
npm ci npm ci
npm run all:ci npm run all:ci
test: # make sure the action works on a clean machine without building test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- uses: ./ - uses: ./
id: stale id: stale
with: with:

View File

@@ -1,20 +1,11 @@
# Changelog # Changelog
# [5.1.1]
[Fix issue when days-before-close is more than days-before-stale](https://github.com/actions/stale/pull/775)
# [5.1.0]
[Don't process stale issues right after they're marked stale](https://github.com/actions/stale/issues/696)
[Add close-issue-reason option][#764](https://github.com/actions/stale/pull/764)[#772](https://github.com/actions/stale/pull/772)
Various dependabot/dependency updates
## [4.1.0](https://github.com/actions/stale/compare/v3.0.19...v4.1.0) (2021-07-14) ## [4.1.0](https://github.com/actions/stale/compare/v3.0.19...v4.1.0) (2021-07-14)
## Features ## Features
- [Ability to exempt draft PRs](https://github.com/actions/stale/commit/9912fa74d1c01b5d6187793d97441019cbe325d0) - [Ability to exempt draft PRs](https://github.com/actions/stale/commit/9912fa74d1c01b5d6187793d97441019cbe325d0
)
## [4.0.0](https://github.com/actions/stale/compare/v3.0.19...v4.0.0) (2021-07-14) ## [4.0.0](https://github.com/actions/stale/compare/v3.0.19...v4.0.0) (2021-07-14)

View File

@@ -46,13 +46,6 @@ Build, lint, package and test everything.
$ npm run all $ npm run all
``` ```
IMPORTANT:
Be sure to commit the result of:
```bash
$ npm run pack
```
Otherwise PR checks will fail.
# Release # Release
Based on [standard-version](https://github.com/conventional-changelog/standard-version). Based on [standard-version](https://github.com/conventional-changelog/standard-version).

View File

@@ -43,7 +43,6 @@ Every argument is optional.
| [close-pr-message](#close-pr-message) | Comment on the staled PRs while closed | | | [close-pr-message](#close-pr-message) | Comment on the staled PRs while closed | |
| [stale-issue-label](#stale-issue-label) | Label to apply on staled issues | `Stale` | | [stale-issue-label](#stale-issue-label) | Label to apply on staled issues | `Stale` |
| [close-issue-label](#close-issue-label) | Label to apply on closed issues | | | [close-issue-label](#close-issue-label) | Label to apply on closed issues | |
| [close-issue-reason](#close-issue-reason) | Reason to use when closing issues | |
| [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` | | [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` |
| [close-pr-label](#close-pr-label) | Label to apply on closed PRs | | | [close-pr-label](#close-pr-label) | Label to apply on closed PRs | |
| [exempt-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | | | [exempt-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | |
@@ -220,12 +219,6 @@ It will be automatically removed if the issues are no longer closed nor locked.
Default value: unset Default value: unset
Required Permission: `issues: write` Required Permission: `issues: write`
#### close-issue-reason
Specify the [reason](https://github.blog/changelog/2022-05-19-the-new-github-issues-may-19th-update/) used when closing issues. Valid values are `completed` and `not_planned`.
Default value: unset
#### stale-pr-label #### stale-pr-label
The label that will be added to the pull requests when automatically marked as stale. The label that will be added to the pull requests when automatically marked as stale.

View File

@@ -1103,7 +1103,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(), issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(), issue.created_at ?? new Date().toDateString(),
!!issue.pull_request, !!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name || '') : [] issue.labels ? issue.labels.map(label => label.name) : []
) )
); );

View File

@@ -50,6 +50,5 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
ignoreUpdates: false, ignoreUpdates: false,
ignoreIssueUpdates: undefined, ignoreIssueUpdates: undefined,
ignorePrUpdates: undefined, ignorePrUpdates: undefined,
exemptDraftPr: false, exemptDraftPr: false
closeIssueReason: ''
}); });

View File

@@ -85,7 +85,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(), issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(), issue.created_at ?? new Date().toDateString(),
!!issue.pull_request, !!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name || '') : [] issue.labels ? issue.labels.map(label => label.name) : []
) )
); );

View File

@@ -1103,7 +1103,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(), issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(), issue.created_at ?? new Date().toDateString(),
!!issue.pull_request, !!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name || '') : [] issue.labels ? issue.labels.map(label => label.name) : []
) )
); );

View File

@@ -455,7 +455,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(), issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(), issue.created_at ?? new Date().toDateString(),
!!issue.pull_request, !!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name || '') : [] issue.labels ? issue.labels.map(label => label.name) : []
) )
); );

View File

@@ -49,10 +49,6 @@ inputs:
description: 'The labels that mean an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2").' description: 'The labels that mean an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2").'
default: '' default: ''
required: false required: false
close-issue-reason:
description: 'The reason to use when closing an issue.'
default: ''
required: false
stale-pr-label: stale-pr-label:
description: 'The label to apply when a pull request is stale.' description: 'The label to apply when a pull request is stale.'
default: 'Stale' default: 'Stale'

3912
dist/index.js vendored

File diff suppressed because one or more lines are too long

193
package-lock.json generated
View File

@@ -10,20 +10,20 @@
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
}, },
"@actions/github": { "@actions/github": {
"version": "5.0.1", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.1.tgz", "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz",
"integrity": "sha512-JZGyPM9ektb8NVTTI/2gfJ9DL7Rk98tQ7OVyTlgTuaQroariRBsOnzjy0I2EarX4xUZpK88YyO503fhmjFdyAg==", "integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==",
"requires": { "requires": {
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.8",
"@octokit/core": "^3.6.0", "@octokit/core": "^3.0.0",
"@octokit/plugin-paginate-rest": "^2.17.0", "@octokit/plugin-paginate-rest": "^2.2.3",
"@octokit/plugin-rest-endpoint-methods": "^5.13.0" "@octokit/plugin-rest-endpoint-methods": "^4.0.0"
} }
}, },
"@actions/http-client": { "@actions/http-client": {
"version": "1.0.11", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==",
"requires": { "requires": {
"tunnel": "0.0.6" "tunnel": "0.0.6"
} }
@@ -561,6 +561,18 @@
"strip-json-comments": "^3.1.1" "strip-json-comments": "^3.1.1"
}, },
"dependencies": { "dependencies": {
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"argparse": { "argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -1370,98 +1382,94 @@
} }
}, },
"@octokit/auth-token": { "@octokit/auth-token": {
"version": "2.5.0", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz",
"integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", "integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==",
"requires": { "requires": {
"@octokit/types": "^6.0.3" "@octokit/types": "^5.0.0"
} }
}, },
"@octokit/core": { "@octokit/core": {
"version": "3.6.0", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.1.tgz",
"integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==", "integrity": "sha512-cQ2HGrtyNJ1IBxpTP1U5m/FkMAJvgw7d2j1q3c9P0XUuYilEgF6e4naTpsgm4iVcQeOnccZlw7XHRIUBy0ymcg==",
"requires": { "requires": {
"@octokit/auth-token": "^2.4.4", "@octokit/auth-token": "^2.4.0",
"@octokit/graphql": "^4.5.8", "@octokit/graphql": "^4.3.1",
"@octokit/request": "^5.6.3", "@octokit/request": "^5.4.0",
"@octokit/request-error": "^2.0.5", "@octokit/types": "^5.0.0",
"@octokit/types": "^6.0.3", "before-after-hook": "^2.1.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/endpoint": { "@octokit/endpoint": {
"version": "6.0.12", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz",
"integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", "integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==",
"requires": { "requires": {
"@octokit/types": "^6.0.3", "@octokit/types": "^5.0.0",
"is-plain-object": "^5.0.0", "is-plain-object": "^4.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/graphql": { "@octokit/graphql": {
"version": "4.8.0", "version": "4.5.2",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.2.tgz",
"integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", "integrity": "sha512-SpB/JGdB7bxRj8qowwfAXjMpICUYSJqRDj26MKJAryRQBqp/ZzARsaO2LEFWzDaps0FLQoPYVGppS0HQXkBhdg==",
"requires": { "requires": {
"@octokit/request": "^5.6.0", "@octokit/request": "^5.3.0",
"@octokit/types": "^6.0.3", "@octokit/types": "^5.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/openapi-types": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz",
"integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA=="
},
"@octokit/plugin-paginate-rest": { "@octokit/plugin-paginate-rest": {
"version": "2.17.0", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.2.4.tgz",
"integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==", "integrity": "sha512-oT/lohKytvstJ4oL7yueNRhqbjYJ7BExYDAHxyYyZtiSZj5y2F1SRINvZwQ+E4esH30YovE2jDysUltty4OYEA==",
"requires": { "requires": {
"@octokit/types": "^6.34.0" "@octokit/types": "^5.0.0"
} }
}, },
"@octokit/plugin-rest-endpoint-methods": { "@octokit/plugin-rest-endpoint-methods": {
"version": "5.13.0", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz",
"integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", "integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==",
"requires": { "requires": {
"@octokit/types": "^6.34.0", "@octokit/types": "^5.1.1",
"deprecation": "^2.3.1" "deprecation": "^2.3.1"
} }
}, },
"@octokit/request": { "@octokit/request": {
"version": "5.6.3", "version": "5.4.7",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz",
"integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", "integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==",
"requires": { "requires": {
"@octokit/endpoint": "^6.0.1", "@octokit/endpoint": "^6.0.1",
"@octokit/request-error": "^2.1.0", "@octokit/request-error": "^2.0.0",
"@octokit/types": "^6.16.1", "@octokit/types": "^5.0.0",
"is-plain-object": "^5.0.0", "deprecation": "^2.0.0",
"node-fetch": "^2.6.7", "is-plain-object": "^4.0.0",
"node-fetch": "^2.3.0",
"once": "^1.4.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/request-error": { "@octokit/request-error": {
"version": "2.1.0", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz",
"integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", "integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==",
"requires": { "requires": {
"@octokit/types": "^6.0.3", "@octokit/types": "^5.0.1",
"deprecation": "^2.0.0", "deprecation": "^2.0.0",
"once": "^1.4.0" "once": "^1.4.0"
} }
}, },
"@octokit/types": { "@octokit/types": {
"version": "6.34.0", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.1.2.tgz",
"integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", "integrity": "sha512-+zuMnja97vuZmWa+HdUY+0KB9MLwcEHueSSyKu0G/HqZaFYCVdLpBkavb0xyDlH7eoBdvAvSX/+Y8+4FOEZkrQ==",
"requires": { "requires": {
"@octokit/openapi-types": "^11.2.0" "@types/node": ">= 8"
} }
}, },
"@sinonjs/commons": { "@sinonjs/commons": {
@@ -1608,8 +1616,7 @@
"@types/node": { "@types/node": {
"version": "15.0.2", "version": "15.0.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.2.tgz",
"integrity": "sha512-p68+a+KoxpoB47015IeYZYRrdqMUcpbK8re/zpFB8Ld46LHC1lPEbp3EXgkEhAYEcPvjJF6ZO+869SQ0aH1dcA==", "integrity": "sha512-p68+a+KoxpoB47015IeYZYRrdqMUcpbK8re/zpFB8Ld46LHC1lPEbp3EXgkEhAYEcPvjJF6ZO+869SQ0aH1dcA=="
"dev": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
"version": "2.4.1", "version": "2.4.1",
@@ -2048,9 +2055,9 @@
} }
}, },
"ajv": { "ajv": {
"version": "6.12.6", "version": "6.12.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==",
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
@@ -2266,9 +2273,9 @@
"dev": true "dev": true
}, },
"before-after-hook": { "before-after-hook": {
"version": "2.2.2", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
@@ -4586,9 +4593,9 @@
"dev": true "dev": true
}, },
"is-plain-object": { "is-plain-object": {
"version": "5.0.0", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" "integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA=="
}, },
"is-potential-custom-element-name": { "is-potential-custom-element-name": {
"version": "1.0.1", "version": "1.0.1",
@@ -7460,9 +7467,9 @@
} }
}, },
"minimist": { "minimist": {
"version": "1.2.6", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true "dev": true
}, },
"minimist-options": { "minimist-options": {
@@ -7501,33 +7508,9 @@
"dev": true "dev": true
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
"requires": {
"whatwg-url": "^5.0.0"
},
"dependencies": {
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
}
}
}, },
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",
@@ -8544,9 +8527,9 @@
}, },
"dependencies": { "dependencies": {
"ajv": { "ajv": {
"version": "8.11.0", "version": "8.6.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz",
"integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",

View File

@@ -39,7 +39,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/github": "^5.0.1", "@actions/github": "^4.0.0",
"lodash.deburr": "^4.1.0", "lodash.deburr": "^4.1.0",
"semver": "^7.3.5" "semver": "^7.3.5"
}, },

View File

@@ -61,8 +61,7 @@ describe('Issue', (): void => {
ignoreUpdates: false, ignoreUpdates: false,
ignoreIssueUpdates: undefined, ignoreIssueUpdates: undefined,
ignorePrUpdates: undefined, ignorePrUpdates: undefined,
exemptDraftPr: false, exemptDraftPr: false
closeIssueReason: ''
}; };
issueInterface = { issueInterface = {
title: 'dummy-title', title: 'dummy-title',

View File

@@ -1,7 +1,7 @@
import {isLabeled} from '../functions/is-labeled'; import {isLabeled} from '../functions/is-labeled';
import {isPullRequest} from '../functions/is-pull-request'; import {isPullRequest} from '../functions/is-pull-request';
import {Assignee} from '../interfaces/assignee'; import {Assignee} from '../interfaces/assignee';
import {IIssue, OctokitIssue} from '../interfaces/issue'; import {IIssue} from '../interfaces/issue';
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options'; import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
import {ILabel} from '../interfaces/label'; import {ILabel} from '../interfaces/label';
import {IMilestone} from '../interfaces/milestone'; import {IMilestone} from '../interfaces/milestone';
@@ -17,30 +17,28 @@ export class Issue implements IIssue {
readonly pull_request: Object | null | undefined; readonly pull_request: Object | null | undefined;
readonly state: string | 'closed' | 'open'; readonly state: string | 'closed' | 'open';
readonly locked: boolean; readonly locked: boolean;
readonly milestone?: IMilestone | null; readonly milestone: IMilestone | undefined;
readonly assignees: Assignee[]; readonly assignees: Assignee[];
isStale: boolean; isStale: boolean;
markedStaleThisRun: boolean;
operations = new Operations(); operations = new Operations();
private readonly _options: IIssuesProcessorOptions; private readonly _options: IIssuesProcessorOptions;
constructor( constructor(
options: Readonly<IIssuesProcessorOptions>, options: Readonly<IIssuesProcessorOptions>,
issue: Readonly<OctokitIssue> | Readonly<IIssue> issue: Readonly<IIssue>
) { ) {
this._options = options; this._options = options;
this.title = issue.title; this.title = issue.title;
this.number = issue.number; this.number = issue.number;
this.created_at = issue.created_at; this.created_at = issue.created_at;
this.updated_at = issue.updated_at; this.updated_at = issue.updated_at;
this.labels = mapLabels(issue.labels); this.labels = issue.labels;
this.pull_request = issue.pull_request; this.pull_request = issue.pull_request;
this.state = issue.state; this.state = issue.state;
this.locked = issue.locked; this.locked = issue.locked;
this.milestone = issue.milestone; this.milestone = issue.milestone;
this.assignees = issue.assignees || []; this.assignees = issue.assignees;
this.isStale = isLabeled(this, this.staleLabel); this.isStale = isLabeled(this, this.staleLabel);
this.markedStaleThisRun = false;
} }
get isPullRequest(): boolean { get isPullRequest(): boolean {
@@ -61,14 +59,3 @@ export class Issue implements IIssue {
: this._options.staleIssueLabel; : this._options.staleIssueLabel;
} }
} }
function mapLabels(labels: (string | ILabel)[] | ILabel[]): ILabel[] {
return labels.map(label => {
if (typeof label == 'string') {
return {
name: label
};
}
return label;
});
}

View File

@@ -1,6 +1,7 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import {context, getOctokit} from '@actions/github'; import {context, getOctokit} from '@actions/github';
import {GitHub} from '@actions/github/lib/utils'; import {GitHub} from '@actions/github/lib/utils';
import {GetResponseTypeFromEndpointMethod} from '@octokit/types';
import {Option} from '../enums/option'; import {Option} from '../enums/option';
import {getHumanizedDate} from '../functions/dates/get-humanized-date'; import {getHumanizedDate} from '../functions/dates/get-humanized-date';
import {isDateMoreRecentThan} from '../functions/dates/is-date-more-recent-than'; import {isDateMoreRecentThan} from '../functions/dates/is-date-more-recent-than';
@@ -24,7 +25,7 @@ import {Milestones} from './milestones';
import {StaleOperations} from './stale-operations'; import {StaleOperations} from './stale-operations';
import {Statistics} from './statistics'; import {Statistics} from './statistics';
import {LoggerService} from '../services/logger.service'; import {LoggerService} from '../services/logger.service';
import {OctokitIssue} from '../interfaces/issue'; import {IIssue} from '../interfaces/issue';
/*** /***
* Handle processing of issues for staleness/closure. * Handle processing of issues for staleness/closure.
@@ -113,11 +114,11 @@ export class IssuesProcessor {
} else { } else {
this._logger.info( this._logger.info(
`${LoggerService.yellow( `${LoggerService.yellow(
'Processing the batch of issues ' 'Processing the batch of issues'
)} ${LoggerService.cyan(`#${page}`)} ${LoggerService.yellow( )} ${LoggerService.cyan(`#${page}`)} ${LoggerService.yellow(
' containing ' 'containing'
)} ${LoggerService.cyan(issues.length)} ${LoggerService.yellow( )} ${LoggerService.cyan(issues.length)} ${LoggerService.yellow(
` issue${issues.length > 1 ? 's' : ''}...` `issue${issues.length > 1 ? 's' : ''}...`
)}` )}`
); );
} }
@@ -151,11 +152,11 @@ export class IssuesProcessor {
); );
this._logger.warning( this._logger.warning(
`${LoggerService.yellowBright( `${LoggerService.yellowBright(
'If you think that not enough issues were processed you could try to increase the quantity related to the ' 'If you think that not enough issues were processed you could try to increase the quantity related to the'
)} ${this._logger.createOptionLink( )} ${this._logger.createOptionLink(
Option.OperationsPerRun Option.OperationsPerRun
)} ${LoggerService.yellowBright( )} ${LoggerService.yellowBright(
' option which is currently set to ' 'option which is currently set to'
)} ${LoggerService.cyan(this.options.operationsPerRun)}` )} ${LoggerService.cyan(this.options.operationsPerRun)}`
); );
this.statistics this.statistics
@@ -166,9 +167,9 @@ export class IssuesProcessor {
} }
this._logger.info( this._logger.info(
`${LoggerService.green('Batch ')} ${LoggerService.cyan( `${LoggerService.green('Batch')} ${LoggerService.cyan(
`#${page}` `#${page}`
)} ${LoggerService.green(' processed.')}` )} ${LoggerService.green('processed.')}`
); );
// Do the next batch // Do the next batch
@@ -465,7 +466,6 @@ export class IssuesProcessor {
); );
await this._markStale(issue, staleMessage, staleLabel, skipMessage); await this._markStale(issue, staleMessage, staleLabel, skipMessage);
issue.isStale = true; // This issue is now considered stale issue.isStale = true; // This issue is now considered stale
issue.markedStaleThisRun = true;
issueLogger.info(`This $$type is now stale`); issueLogger.info(`This $$type is now stale`);
} else { } else {
issueLogger.info( issueLogger.info(
@@ -517,7 +517,7 @@ export class IssuesProcessor {
try { try {
this._consumeIssueOperation(issue); this._consumeIssueOperation(issue);
this.statistics?.incrementFetchedItemsCommentsCount(); this.statistics?.incrementFetchedItemsCommentsCount();
const comments = await this.client.rest.issues.listComments({ const comments = await this.client.issues.listComments({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@@ -532,20 +532,25 @@ export class IssuesProcessor {
// grab issues from github in batches of 100 // grab issues from github in batches of 100
async getIssues(page: number): Promise<Issue[]> { async getIssues(page: number): Promise<Issue[]> {
// generate type for response
const endpoint = this.client.issues.listForRepo;
type OctoKitIssueList = GetResponseTypeFromEndpointMethod<typeof endpoint>;
try { try {
this.operations.consumeOperation(); this.operations.consumeOperation();
const issueResult = await this.client.rest.issues.listForRepo({ const issueResult: OctoKitIssueList =
owner: context.repo.owner, await this.client.issues.listForRepo({
repo: context.repo.repo, owner: context.repo.owner,
state: 'open', repo: context.repo.repo,
per_page: 100, state: 'open',
direction: this.options.ascending ? 'asc' : 'desc', per_page: 100,
page direction: this.options.ascending ? 'asc' : 'desc',
}); page
});
this.statistics?.incrementFetchedItemsCount(issueResult.data.length); this.statistics?.incrementFetchedItemsCount(issueResult.data.length);
return issueResult.data.map( return issueResult.data.map(
(issue: Readonly<OctokitIssue>): Issue => new Issue(this.options, issue) (issue: Readonly<IIssue>): Issue => new Issue(this.options, issue)
); );
} catch (error) { } catch (error) {
this._logger.error(`Get issues for repo error: ${error.message}`); this._logger.error(`Get issues for repo error: ${error.message}`);
@@ -565,7 +570,7 @@ export class IssuesProcessor {
this._consumeIssueOperation(issue); this._consumeIssueOperation(issue);
this.statistics?.incrementFetchedItemsEventsCount(); this.statistics?.incrementFetchedItemsEventsCount();
const options = this.client.rest.issues.listEvents.endpoint.merge({ const options = this.client.issues.listEvents.endpoint.merge({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
per_page: 100, per_page: 100,
@@ -596,7 +601,7 @@ export class IssuesProcessor {
this._consumeIssueOperation(issue); this._consumeIssueOperation(issue);
this.statistics?.incrementFetchedPullRequestsCount(); this.statistics?.incrementFetchedPullRequestsCount();
const pullRequest = await this.client.rest.pulls.get({ const pullRequest = await this.client.pulls.get({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
pull_number: issue.number pull_number: issue.number
@@ -625,15 +630,13 @@ export class IssuesProcessor {
`$$type marked stale on: ${LoggerService.cyan(markedStaleOn)}` `$$type marked stale on: ${LoggerService.cyan(markedStaleOn)}`
); );
const issueHasCommentsSinceStale: boolean = await this._hasCommentsSince( const issueHasComments: boolean = await this._hasCommentsSince(
issue, issue,
markedStaleOn, markedStaleOn,
staleMessage staleMessage
); );
issueLogger.info( issueLogger.info(
`$$type has been commented on: ${LoggerService.cyan( `$$type has been commented on: ${LoggerService.cyan(issueHasComments)}`
issueHasCommentsSinceStale
)}`
); );
const daysBeforeClose: number = issue.isPullRequest const daysBeforeClose: number = issue.isPullRequest
@@ -644,6 +647,14 @@ export class IssuesProcessor {
`Days before $$type close: ${LoggerService.cyan(daysBeforeClose)}` `Days before $$type close: ${LoggerService.cyan(daysBeforeClose)}`
); );
const issueHasUpdate: boolean = IssuesProcessor._updatedSince(
issue.updated_at,
daysBeforeClose
);
issueLogger.info(
`$$type has been updated: ${LoggerService.cyan(issueHasUpdate)}`
);
const shouldRemoveStaleWhenUpdated: boolean = const shouldRemoveStaleWhenUpdated: boolean =
this._shouldRemoveStaleWhenUpdated(issue); this._shouldRemoveStaleWhenUpdated(issue);
@@ -661,27 +672,10 @@ export class IssuesProcessor {
); );
} }
if (issue.markedStaleThisRun) {
issueLogger.info(`marked stale this run, so don't check for updates`);
}
const issueHasUpdateSinceStale =
new Date(issue.updated_at) > new Date(markedStaleOn);
issueLogger.info(
`$$type has been updated since it was marked stale: ${LoggerService.cyan(
issueHasUpdateSinceStale
)}`
);
// Should we un-stale this issue? // Should we un-stale this issue?
if ( if (shouldRemoveStaleWhenUpdated && issueHasComments) {
shouldRemoveStaleWhenUpdated &&
(issueHasUpdateSinceStale || issueHasCommentsSinceStale) &&
!issue.markedStaleThisRun
) {
issueLogger.info( issueLogger.info(
`Remove the stale label since the $$type has been updated and the workflow should remove the stale label when updated` `Remove the stale label since the $$type has a comment and the workflow should remove the stale label when updated`
); );
await this._removeStaleLabel(issue, staleLabel); await this._removeStaleLabel(issue, staleLabel);
@@ -699,17 +693,7 @@ export class IssuesProcessor {
return; // Nothing to do because we aren't closing stale issues return; // Nothing to do because we aren't closing stale issues
} }
const issueHasUpdateInCloseWindow: boolean = IssuesProcessor._updatedSince( if (!issueHasComments && !issueHasUpdate) {
issue.updated_at,
daysBeforeClose
);
issueLogger.info(
`$$type has been updated in the last ${daysBeforeClose} days: ${LoggerService.cyan(
issueHasUpdateInCloseWindow
)}`
);
if (!issueHasCommentsSinceStale && !issueHasUpdateInCloseWindow) {
issueLogger.info( issueLogger.info(
`Closing $$type because it was last updated on: ${LoggerService.cyan( `Closing $$type because it was last updated on: ${LoggerService.cyan(
issue.updated_at issue.updated_at
@@ -728,7 +712,7 @@ export class IssuesProcessor {
} }
} else { } else {
issueLogger.info( issueLogger.info(
`Stale $$type is not old enough to close yet (hasComments? ${issueHasCommentsSinceStale}, hasUpdate? ${issueHasUpdateInCloseWindow})` `Stale $$type is not old enough to close yet (hasComments? ${issueHasComments}, hasUpdate? ${issueHasUpdate})`
); );
} }
} }
@@ -754,8 +738,8 @@ export class IssuesProcessor {
const filteredComments = comments.filter( const filteredComments = comments.filter(
comment => comment =>
comment.user?.type === 'User' && comment.user.type === 'User' &&
comment.body?.toLowerCase() !== staleMessage.toLowerCase() comment.body.toLowerCase() !== staleMessage.toLowerCase()
); );
issueLogger.info( issueLogger.info(
@@ -791,7 +775,7 @@ export class IssuesProcessor {
this.statistics?.incrementAddedItemsComment(issue); this.statistics?.incrementAddedItemsComment(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.createComment({ await this.client.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@@ -809,7 +793,7 @@ export class IssuesProcessor {
this.statistics?.incrementStaleItemsCount(issue); this.statistics?.incrementStaleItemsCount(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.addLabels({ await this.client.issues.addLabels({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@@ -839,7 +823,7 @@ export class IssuesProcessor {
this.addedCloseCommentIssues.push(issue); this.addedCloseCommentIssues.push(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.createComment({ await this.client.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@@ -857,7 +841,7 @@ export class IssuesProcessor {
this.statistics?.incrementAddedItemsLabel(issue); this.statistics?.incrementAddedItemsLabel(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.addLabels({ await this.client.issues.addLabels({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@@ -874,12 +858,11 @@ export class IssuesProcessor {
this.statistics?.incrementClosedItemsCount(issue); this.statistics?.incrementClosedItemsCount(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.update({ await this.client.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
state: 'closed', state: 'closed'
state_reason: this.options.closeIssueReason || undefined
}); });
} }
} catch (error) { } catch (error) {
@@ -917,7 +900,7 @@ export class IssuesProcessor {
this.statistics?.incrementDeletedBranchesCount(); this.statistics?.incrementDeletedBranchesCount();
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.git.deleteRef({ await this.client.git.deleteRef({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
ref: `heads/${branch}` ref: `heads/${branch}`
@@ -952,7 +935,7 @@ export class IssuesProcessor {
this.statistics?.incrementDeletedItemsLabelsCount(issue); this.statistics?.incrementDeletedItemsLabelsCount(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.removeLabel({ await this.client.issues.removeLabel({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,
@@ -1085,7 +1068,7 @@ export class IssuesProcessor {
this._consumeIssueOperation(issue); this._consumeIssueOperation(issue);
this.statistics?.incrementAddedItemsLabel(issue); this.statistics?.incrementAddedItemsLabel(issue);
if (!this.options.debugOnly) { if (!this.options.debugOnly) {
await this.client.rest.issues.addLabels({ await this.client.issues.addLabels({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: issue.number, issue_number: issue.number,

View File

@@ -46,6 +46,5 @@ export enum Option {
IgnoreUpdates = 'ignore-updates', IgnoreUpdates = 'ignore-updates',
IgnoreIssueUpdates = 'ignore-issue-updates', IgnoreIssueUpdates = 'ignore-issue-updates',
IgnorePrUpdates = 'ignore-pr-updates', IgnorePrUpdates = 'ignore-pr-updates',
ExemptDraftPr = 'exempt-draft-pr', ExemptDraftPr = 'exempt-draft-pr'
CloseIssueReason = 'close-issue-reason'
} }

View File

@@ -9,6 +9,6 @@ import {CleanLabel} from '../types/clean-label';
* *
* @return {string} A lowercased, deburred version of the passed in label * @return {string} A lowercased, deburred version of the passed in label
*/ */
export function cleanLabel(label?: Readonly<string>): CleanLabel { export function cleanLabel(label: Readonly<string>): CleanLabel {
return deburr(label?.toLowerCase()); return deburr(label.toLowerCase());
} }

View File

@@ -1,6 +1,6 @@
import {IUser} from './user'; import {IUser} from './user';
export interface IComment { export interface IComment {
user: IUser | null; user: IUser;
body?: string; body: string;
} }

View File

@@ -2,18 +2,16 @@ import {IsoDateString} from '../types/iso-date-string';
import {Assignee} from './assignee'; import {Assignee} from './assignee';
import {ILabel} from './label'; import {ILabel} from './label';
import {IMilestone} from './milestone'; import {IMilestone} from './milestone';
import {components} from '@octokit/openapi-types';
export interface IIssue { export interface IIssue {
title: string; title: string;
number: number; number: number;
created_at: IsoDateString; created_at: IsoDateString;
updated_at: IsoDateString; updated_at: IsoDateString;
labels: ILabel[]; labels: ILabel[];
pull_request?: Object | null; pull_request: Object | null | undefined;
state: string; state: string;
locked: boolean; locked: boolean;
milestone?: IMilestone | null; milestone: IMilestone | undefined;
assignees?: Assignee[] | null; assignees: Assignee[];
} }
export type OctokitIssue = components['schemas']['issue'];

View File

@@ -51,5 +51,4 @@ export interface IIssuesProcessorOptions {
ignoreIssueUpdates: boolean | undefined; ignoreIssueUpdates: boolean | undefined;
ignorePrUpdates: boolean | undefined; ignorePrUpdates: boolean | undefined;
exemptDraftPr: boolean; exemptDraftPr: boolean;
closeIssueReason: string;
} }

View File

@@ -1,3 +1,3 @@
export interface ILabel { export interface ILabel {
name?: string; name: string;
} }

View File

@@ -3,5 +3,5 @@ export interface IPullRequest {
head: { head: {
ref: string; ref: string;
}; };
draft?: boolean; draft: boolean;
} }

View File

@@ -87,8 +87,7 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
ignoreUpdates: core.getInput('ignore-updates') === 'true', ignoreUpdates: core.getInput('ignore-updates') === 'true',
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'), ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'), ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true', exemptDraftPr: core.getInput('exempt-draft-pr') === 'true'
closeIssueReason: core.getInput('close-issue-reason')
}; };
for (const numberInput of [ for (const numberInput of [
@@ -114,15 +113,6 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
} }
} }
const validCloseReasons = ['', 'completed', 'not_planned'];
if (!validCloseReasons.includes(args.closeIssueReason)) {
const errorMessage = `Unrecognized close-issue-reason "${
args.closeIssueReason
}", valid values are: ${validCloseReasons.filter(Boolean).join(', ')}`;
core.setFailed(errorMessage);
throw new Error(errorMessage);
}
return args; return args;
} }