A GitHub Action that requests more info when required content is not included in an issue.
MIT License
A GitHub Action that requests more info when required content is not included in an issue. You can check out test runs here.
The Action has two properties that have defaults and are not required.
.github/need-info.yml
${{ github.token }}
# .github/workflows/verify-info.yml
name: 'Need Info - Verify'
on:
issues:
types: [labeled]
branches: [master]
issue_comment:
types: [created]
branches: [master]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: benelan/need-info-action@v2
# the rest is not required if using the defaults
with:
github-token: 'super-duper-secret-token-sshhh'
config-path: '.github/configs/not-default.yml'
The following properties can be set in the configuration file.
Config Property | Type | Description |
---|---|---|
requiredItems (required) | InfoItem[] | Items that an issue with a labelToCheck must include, triggers a response if they are missing |
labelsToCheck (required) | string[] | Labels that trigger a check for InfoItem content |
labelToAdd (required) | string | Label added to issues with missing information |
commentHeader | string | Comment message to add above the ItemInfo responses |
commentFooter | string | Comment message to add below the ItemInfo responses |
caseSensitive | boolean | Whether InfoItem content is case sensitive, default: false |
excludeComments | boolean | Exclude content in markdown comments when parsing for InfoItem content, default: false |
exemptUsers | string[] | Users that are exempt from providing InfoItem content |
includedItems | InfoItem[] | Items that trigger a response if they are included and the action found missing requiredItems |
InfoItem Property | Type | Description |
---|---|---|
content (required) | string[] | A list of content to check for in an issue or comment |
response (required) | string | A response to comment on an issue if requirements are not satisfied |
requireAll (required) | boolean | Whether to require all of the content items or just one |
# .github/need-info.yml
labelToAdd: 'need more info'
labelsToCheck:
- 'bug'
- 'enhancement'
requiredItems:
- content:
- '## Actual Behavior'
- '## Expected Behavior'
response: '- Use the appropriate format from the issue templates'
requireAll: true
- content:
- 'jsbin.com'
- 'codepen.io'
- 'jsfiddle.net'
- 'codesandbox.io'
response: '- A sample that reproduces the issue'
requireAll: false
# optional properties below
commentHeader: 'More information is required to proceed:'
commentFooter: 'This issue will be automatically closed in a week if the information is not provided. Thanks for your understanding.'
caseSensitive: true
excludeComments: true # don't parse markdown comments in the issue/comment
exemptUsers:
- benelan
includedItems:
- content:
- 'https://esri.github.io/calcite-components/?path=/story/components-'
- 'https://developers.arcgis.com/calcite-design-system/components/'
response: ' - @benelan will confirm that the issue is reproducible in the documentation. In the meantime, **no action is required** on your end.'
requireAll: false
The appropriate method is determined depending on whether the Action is triggered by an issue or comment event.
The issues
event methods can be run on opened
, edited
, and/or labeled
.
opened
action checks if an issue has at least one of the labelsToCheck
. The labeled
action, checks if the added label is a label to check. If so, it checks the issue body for the requiredItems
.
labelToAdd
is added to the issue. The Action comments on the issue with the response
for all of the requiredItems
that were not provided. The Action also comments with the response for the includedItems
that are in the issue. The includedItems
can be used to explain why certain content cannot be accepted in place of required items, among other things.edited
action checks if an issue has the labelToAdd
. If it does, it checks the issue body for the required items.
labelToAdd
is removed.The issue_comment
event method can be run on created
and/or edited
actions.
labelToAdd
then the Action checks the comment for any requiredItems
.
labelToAdd
is removed from the issue.requiredItems
then the Action ends.labelToAdd
, or the commenter is not the original poster, then the Action ends.Note: If there were multiple
requiredItems
that the commenter needed and they only provided one, the maintainer can manually ask for the additional items and add back thelabelToAdd
.
This Action can be used in conjunction with Close Stale Issues, which can be set up to close issues with the labelToAdd
after a certain amount of time. You can check out a test run here.
# .github/workflows/close-issue.yml
name: 'Need Info - Close'
on:
schedule:
- cron: '30 1 * * *'
jobs:
close:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
days-before-stale: -1 # do not automatically label issues
days-before-close: 7
remove-stale-when-updated: false # do not automatically remove label
stale-issue-label: 'need more info'
stale-pr-label: 'need more info'
close-issue-message: 'This issue has been automatically closed due to missing information. We will reopen the issue if the information is provided.'