Tests are nice, but sometimes you want an additional checklist of items to check before merging a PR (for example, grammar check for documentation changes or last-minute check of visual look). This action allows you to build filename-based checklists to remind the PR author about.
The action reads a checklist specification file (by default CHECKLIST.yml
) from the repository root and submits a checklist comment to new/modified PRs based on what files were modified.
This is a modified version of https://github.com/wyozi/contextual-qa-checklist-action which supports multiple paths for a checklist.
CHECKLIST.yml
store:
"paths":
- "Store/**.js"
- "Cart/**.html"
"description":
- Please check the following store pages (general)
"items":
- Store checklist 1
- Store checklist 2
blog:
"paths":
- "Blog/**.php"
- "Blogger/**.ts"
"description":
- Please check the following blog pages (general)
"items":
- Blog checklist 1
- Blog checklist 2
Options | Description |
---|---|
comment-header | Overrides the default header text in the PR comment. |
comment-footer | Overrides the default footer text in the PR comment. |
include-hidden-files | Includes files and folders starting with . when matching. Defaults to false . |
input-file | The path to the checklist definition file. Default to CHECKLIST.yml in the project root. |
gh-token | The Github token for your project. This is autogenerated by github. |
show-paths | Shows the matched file path in the PR comment. Defaults to true . |
.github/workflows/checklist.yml
on: pull_request
jobs:
checklist_job:
permissions:
pull-requests: write
contents: read
runs-on: ubuntu-latest
name: Checklist
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Checklist
uses: batbattur/contextual-qa-checklist-action@master
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
# For custom location of the checklist file.
input-file: '.github/QAchecklist.yml'
# For custom comment header message
comment-header: "Hey, by the way, we noticed the following changes:"
File matcher uses https://github.com/isaacs/minimatch. Here is a cheat sheet for simple explanation https://github.com/motemen/minimatch-cheat-sheet
Example for the checklist file paths:
**.js
matches js file only in the root folder.**/**.js
matches all js files in all subfolders.Store/**.js
matches all js files in theStore
folder.Store/**/**.js
matches all js files in theStore
folder and in its subfolders.
Pattern | Matches | Does not match |
---|---|---|
**.js |
Test.js |
Subfolder1/Subolder2/Test.js |
**/**.js |
Test.js , Subfolder1/Subfolder2/Test.js |
|
Store/**.js |
Store/Test.js |
Store/Subfolder/Test.js |
Store/**/**.js |
Store/Test.js , Store/Subfolder/Test.js |
When matching files are updated in a PR, the action will automatically post a checklist containing items under that path's key.
See batbattur/All#36 (comment) for an example PR checklist. Example workflow: https://github.com/batbattur/All/blob/master/.github/workflows/checklist.yml Example checklist file: https://github.com/batbattur/All/blob/master/.github/QAchecklist.yml
After making any changes, you need to run npm run build-dist
and push the updated dist
folder to the repo.