Skip to content

Commit

Permalink
feat: add option to filter which issues to verify
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Sep 19, 2023
1 parent eb02744 commit ecbf8b4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Nissuer
uses: balazsorban44/nissuer@1.3.5
uses: balazsorban44/nissuer@1.4.0
with:
label-area-section: 'Which area\(s\) are affected\?(.*)'
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"search.exclude": {
"dist": true,
},
"files.exclude": {
"dist": true,
".vscode": true
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Nissuer
uses: balazsorban44/nissuer@1.3.5
uses: balazsorban44/nissuer@1.4.0
```

Add a comment file (by default we look for `.github/invalid-reproduction.md`):
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ inputs:
reproduction-invalid-label:
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"'
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"'
default: '### Link to reproduction(.*)### To reproduce'
Expand All @@ -40,6 +43,7 @@ runs:
"INPUT_REPRODUCTION_COMMENT": ${{inputs.reproduction-comment}}
"INPUT_REPRODUCTION_HOSTS": ${{inputs.reproduction-hosts}}
"INPUT_REPRODUCTION_INVALID_LABEL": ${{inputs.reproduction-invalid-label}}
"INPUT_REPRODUCTION_ISSUE_LABELS": ${{inputs.reproduction-issue-labels}}
"INPUT_REPRODUCTION_LINK_SECTION": ${{inputs.reproduction-link-section}}
"INPUT_LABEL_COMMENTS": ${{inputs.label-comments}}
"INPUT_LABEL_AREA_PREFIX": ${{inputs.label-area-prefix}}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const config = {
invalidLink: {
comment:
getInput("reproduction_comment") || ".github/invalid-reproduction.md",
bugLabels: getInput("reproduction_issue_labels")
.split(",")
.map((l) => l.trim()),
hosts: (getInput("reproduction_hosts") || "github.com")
.split(",")
.map((h) => h.trim()),
Expand Down Expand Up @@ -47,6 +50,15 @@ async function checkValidReproduction() {

if (action !== "opened" || !issue?.body) return

/** @type {string[]} */
const labels = issue.labels.map((l) => l.name)

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

if (await isValidReproduction(issue.body))
return info(`Issue #${issue.number} contains a valid reproduction 💚`)

Expand Down

0 comments on commit ecbf8b4

Please sign in to comment.