| # Copyright (c) 2026 Project CHIP Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| name: PR Checker Bot |
| |
| on: |
| workflow_dispatch: |
| inputs: |
| dry_run: |
| description: 'Dry run (simulate merging and commenting)' |
| required: false |
| type: boolean |
| default: false |
| schedule: |
| # Run every 6 hours (4 times a day) |
| - cron: "0 */6 * * *" |
| |
| jobs: |
| pr_checker: |
| name: PR Checker Bot |
| runs-on: ubuntu-latest |
| |
| # Limit to main repo to avoid running on forks |
| if: github.repository_owner == 'project-chip' |
| |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v7 |
| |
| - name: Setup Python |
| uses: actions/setup-python@v6 |
| with: |
| python-version: '3.12' |
| |
| - name: Setup pip modules |
| run: | |
| python3 -m venv venv |
| venv/bin/pip3 install \ |
| click==8.1.7 \ |
| coloredlogs==15.0.1 \ |
| pyyaml==6.0.1 \ |
| pathspec==0.12.1 \ |
| pygithub==2.3.0 \ |
| && echo "DONE installing python prerequisites" |
| |
| - name: Run PR Checker Bot |
| env: |
| GH_TOKEN: ${{ secrets.MERGE_BOT_PAT || secrets.MATTER_PAT }} |
| DRY_RUN_INPUT: ${{ github.event.inputs.dry_run }} |
| run: | |
| # If manual trigger, use the input dry_run value. Otherwise, default to false (actual run). |
| DRY_RUN_FLAG="" |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "$DRY_RUN_INPUT" = "true" ]; then |
| DRY_RUN_FLAG="--dry-run" |
| fi |
| |
| venv/bin/python3 scripts/tools/pr_checker_bot.py $DRY_RUN_FLAG |