Skip to content

Commit

Permalink
feat: support interpreting no-label issue as invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Feb 12, 2024
1 parent a322004 commit af6911b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Nissuer
uses: balazsorban44/nissuer@1.8.2
uses: balazsorban44/nissuer@1.9.0
with:
label-area-section: 'Which area\(s\) are affected\?(.*)'
reproduction-issue-labels: 'bug,'
reproduction-issue-labels: "bug,"
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ nissuer comes with a default configuration, but you can override certain behavio
- nissuer can close/comment/label/lock issues that do not have a valid reproduction URL
- nissuer validates the returned status code of a reproduction URL (for example a private GitHub repository will not be considered valid)

| Input | Description | Default Value |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `reproduction-comment` | Either a string or a path to a .md file inside the repository. | `.github/invalid-reproduction.md` |
| `reproduction-hosts` | Comma-separated list of hostnames allowed for reproductions. | `github.com` |
| `reproduction-blocklist` | Comma-separated list of regular expression string that are not allowed for reproductions. (Eg.: "github.com/.\*/fork-of-non-reproduction"') | |
| `reproduction-invalid-label` | Label to apply to issues without a valid reproduction. | `invalid-reproduction` |
| `reproduction-issue-labels` | Comma-separated list of issue labels. If configured, only verify reproduction URLs of issues with one of these labels present. | |
| `reproduction-link-section` | A regular expression string with "(.\*)" matching a valid URL in the issue body. The result is trimmed. | `### Link to reproduction(.*)### To reproduce` |
| Input | Description | Default Value |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `reproduction-comment` | Either a string or a path to a .md file inside the repository. | `.github/invalid-reproduction.md` |
| `reproduction-hosts` | Comma-separated list of hostnames allowed for reproductions. | `github.com` |
| `reproduction-blocklist` | Comma-separated list of regular expression string that are not allowed for reproductions. (Eg.: "github.com/.\*/fork-of-non-reproduction"') | |
| `reproduction-invalid-label` | Label to apply to issues without a valid reproduction. | `invalid-reproduction` |
| `reproduction-issue-labels` | Comma-separated list of issue labels. If configured, only verify reproduction URLs of issues with one of these labels present. A comma at the end will handle issues without any label as non-valid. | |
| `reproduction-link-section` | A regular expression string with "(.\*)" matching a valid URL in the issue body. The result is trimmed. | `### Link to reproduction(.*)### To reproduce` |

### Label Management

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Nissuer
uses: balazsorban44/nissuer@1.8.2
uses: balazsorban44/nissuer@1.9.0
```

Add a comment file (by default we look for `.github/invalid-reproduction.md`):
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inputs:
description: 'Label to apply to issues without a valid reproduction. Example: "invalid-reproduction"'
default: 'invalid-reproduction'
reproduction-issue-labels:
description: 'Comma-separated list of issue labels. If configured, only verify reproduction URLs of issues with one of these labels present. Example: "bug"'
description: 'Comma-separated list of issue labels. If configured, only verify reproduction URLs of issues with one of these labels present. Adding a comma at the end will handle non-labeled issues as invalid. Example: "bug,", will consider issues with the label "bug" or no label.'
default: ''
reproduction-link-section:
description: 'A regular expression string with "(.*)" matching a valid URL in the issue body. The result is trimmed. Example: "### Link to reproduction(.*)### To reproduce"'
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ async function checkValidReproduction() {
const labels = issue.labels.map((l) => l.name)

if (
config.invalidLink.bugLabels.length &&
!labels.some((l) => config.invalidLink.bugLabels.includes(l))
(!labels.length && config.invalidLink.bugLabels.includes("")) ||
(config.invalidLink.bugLabels.length &&
!labels.some((l) => config.invalidLink.bugLabels.includes(l)))
)
return info("Not manually or already labeled")

Expand Down

0 comments on commit af6911b

Please sign in to comment.