General commissioning dependency injection #28777
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR validity | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| jobs: | |
| check_testing_header: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check for `### Testing` section in PR | |
| id: check-testing | |
| continue-on-error: true | |
| run: | | |
| cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary" | |
| ${{ github.event.pull_request.body }} | |
| EndMarkerForPrSummary | |
| python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(0 if "### Testing" in pr_summary else 1)' | |
| - name: Check for PR starting instructions | |
| id: check-instructions | |
| continue-on-error: true | |
| run: | | |
| cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary" | |
| ${{ github.event.pull_request.body }} | |
| EndMarkerForPrSummary | |
| python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(1 if "Please replace this HTML comment" in pr_summary else 0)' | |
| # NOTE: comments disabled for now as separate permissions are required | |
| # failing CI step may be sufficient to start (although it contains less information about why it failed) | |
| # - name: Add comment (missing instructions) | |
| # if: steps.check-instructions.outcome == 'failure' | |
| # uses: actions/github-script@v6 | |
| # with: | |
| # github-token: ${{ secrets.GITHUB_TOKEN }} | |
| # script: | | |
| # github.rest.issues.createComment({ | |
| # issue_number: context.issue.number, | |
| # owner: context.repo.owner, | |
| # repo: context.repo.repo, | |
| # body: 'Please make sure to delete starter instructions from your PR summary and replace them with a descriptive summary.' | |
| # }) | |
| - name: Fail if PR instructions were not deleted | |
| if: (steps.check-instructions.outcome == 'failure') && (github.event.pull_request.user.login != 'dependabot[bot]') | |
| run: | | |
| python -c 'import sys; print("Please remove the HTML comment blocks that include \"Please replace this HTML comment\" text."); sys.exit(1)' | |
| # - name: Add comment (missing testing) | |
| # if: steps.check-testing.outcome == 'failure' | |
| # uses: actions/github-script@v6 | |
| # with: | |
| # github-token: ${{ secrets.GITHUB_TOKEN }} | |
| # script: | | |
| # github.rest.issues.createComment({ | |
| # issue_number: context.issue.number, | |
| # owner: context.repo.owner, | |
| # repo: context.repo.repo, | |
| # body: 'Please add a `### Testing` section to your PR summary describing the testing performed. See https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#pull-requests' | |
| # }) | |
| - name: Fail if `### Testing` section not in PR | |
| if: (steps.check-testing.outcome == 'failure') && (github.event.pull_request.user.login != 'dependabot[bot]') | |
| run: | | |
| python -c 'import sys; print("Testing section missing (test failed)"); sys.exit(1)' |