crystal_ball 1.0.0 crystal_ball: ^1.0.0 copied to clipboard
A simple tool to respond to new issue (github action core component). App can check if github issue mets established requirements if not, comments and labels can be added
Crystal Ball #
Crystal ball is an easy app to check if github issue can be consider as invalid or dummy. It's also a GitHub
action which simplify usage.
Problem to solve #
From time to time we are expecting issues which are not actionable.
Empty issue body is an example of unactionable issue. Simillarly if issue template with checklist is given but no field is selected, it's possible to consider an issue as not ready to be triaged.
The Crystal Ball
action will check issue description and respond to it base on predefined checks or customer provided regular expressions
Usage #
Action example #
name: crystall ball
on:
issues:
types: [opened, edited]
jobs:
fortune_teller:
runs-on: ubuntu-latest
name: Fortune teller
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Crystal Ball
# rm line below if you want to apply same rules for PR description
if: ${{ !github.event.issue.pull_request }}
uses: n0npax/crystal-ball@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CRYSTAL_MATCH_REGEX_BAR: 'description:?\s*\Z'
CRYSTAL_NOMATCH_REGEX_FOO: '(\w+\s+){0,10}'
# COMMENT_MSG: blah blah blah
with:
repoName: ${{ github.repository }}
issueNum: ${{ github.event.issue.number }}
labels: "invalid,crystall ball needed"
ENV variables #
Default comment message cen be changed by:
COMMENT_MSG: "comment message (above failure reason)
Multiple regular expressions can be used to validate issue body. Any ENV variable starting with CRYSTAL_{NO,}MATCH_REGEX
will be used. If match does/doesn't exists, issue is consider as invalid and crystal ball will comment.
CRYSTAL_NOMATCH_REGEX_FOO: '^foo$'
CRYSTAL_MATCH_REGEX_BAR: 'bar{4}'
Github token is required to perform actions.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Example #
How action may look like:
Live demo #
Just raise an issue with empty body here.
LICENSE #
Code under MIT license.