Skip to content

Commit

Permalink
PR validation: write the pullrequest body as a separate file and an e…
Browse files Browse the repository at this point in the history
…nd marker (project-chip#37030)

* PR validation: write the pullrequest body as a separate file with a echo marker

This avoids having quotes or other text considered special. Tried to
name the marker in a way that is reasonably unique and unlikely to be
part of real PR summaries. WE can change it more if we really need to.

* Minor change to kick CI
  • Loading branch information
andy31415 authored Jan 10, 2025
1 parent db02354 commit 5f8bc8c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@ 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)'
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: |
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)'
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 "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)
Expand Down

0 comments on commit 5f8bc8c

Please sign in to comment.