forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce
### Testing
section in pull requests and check that the sta…
…rter instructions were deleted/replaced (project-chip#37013) * Add PR summary validation workflow and documentation. Added documentation to CONTRIBUTING.md and created a workflow that enforces a `### Testing` section. * Fix odd md formatting --------- Co-authored-by: Andrei Litvin <[email protected]>
- Loading branch information
1 parent
d3204f6
commit b83c27a
Showing
5 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -757,6 +757,7 @@ js | |
json | ||
JTAG | ||
Jupyter | ||
judgement | ||
jupyterlab | ||
KA | ||
kAdminister | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
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: | | ||
python -c 'import sys; pr_summary = """${{ github.event.pull_request.body }}"""; sys.exit(0 if "### Testing" in pr_summary else 1)' | ||
- name: Check for PR starting instructions | ||
id: check-instructions | ||
continue-on-error: true | ||
run: | | ||
python -c 'import sys; pr_summary = """${{ github.event.pull_request.body }}"""; sys.exit(1 if "Make sure you delete these instructions" 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' | ||
run: | | ||
python -c 'import sys; print("PR instructions were not replaced"); 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' | ||
run: | | ||
python -c 'import sys; print("Testing section missing (test failed)"); sys.exit(1)' | ||
This file contains 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