A GitHub Action that verifies a pull request has been reviewed for product compatibility before merging.
When a PR is opened or updated, the action checks for a compatibility-reviewed label. If the label is missing, the check fails and a comment is posted on the PR reminding the developer to review the themeisle_sdk_compatibilities filter. Once the label is added and the check re-runs, the comment is automatically removed.
Create .github/workflows/compatibility-check.yml in your repository:
name: Compatibility Check
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
branches:
- main
jobs:
compatibility-check:
name: Verify Compatibility Review
runs-on: ubuntu-latest
steps:
- name: Check compatibility label
uses: Codeinwp/action-product-compat@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}| Input | Required | Default | Description |
|---|---|---|---|
github-token |
Yes | — | GitHub token used to read labels and post comments. Use ${{ secrets.GITHUB_TOKEN }}. |
label |
No | compatibility-reviewed |
The label that marks a PR as reviewed. |
message |
No | (see below) | Custom comment message posted when the label is missing. |
Default message:
Make sure you've reviewed the
themeisle_sdk_compatibilitiesfilter of the plugin and updated it accordingly.
| Output | Description |
|---|---|
has_label |
"true" or "false" — whether the compatibility label is present on the PR. |
- name: Check compatibility label
uses: Codeinwp/action-product-compat@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
message: 'Please review the compatibility matrix before merging.'- PR opened / updated — the action checks if the
compatibility-reviewedlabel is on the PR. - Label missing — the action fails and posts a comment. If a comment already exists from a previous run, it is updated rather than duplicated.
- Label added — the action passes and the bot comment is automatically removed from the PR.
Install dependencies:
npm installBuild the distributable (required before committing or releasing):
npm run buildCommit the generated dist/ folder along with your changes.