Skip to content

Commit 5f8bc8c

Browse files
authored
PR validation: write the pullrequest body as a separate file and an end marker (#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
1 parent db02354 commit 5f8bc8c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/pr-validation.yaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@ jobs:
88
check_testing_header:
99
runs-on: ubuntu-latest
1010
steps:
11-
1211
- name: Check for `### Testing` section in PR
1312
id: check-testing
1413
continue-on-error: true
1514
run: |
16-
python -c 'import sys; pr_summary = """${{ github.event.pull_request.body }}"""; sys.exit(0 if "### Testing" in pr_summary else 1)'
15+
cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary"
16+
${{ github.event.pull_request.body }}
17+
EndMarkerForPrSummary
18+
19+
python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(0 if "### Testing" in pr_summary else 1)'
1720
1821
- name: Check for PR starting instructions
1922
id: check-instructions
2023
continue-on-error: true
2124
run: |
22-
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)'
25+
cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary"
26+
${{ github.event.pull_request.body }}
27+
EndMarkerForPrSummary
28+
29+
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)'
2330
2431
# NOTE: comments disabled for now as separate permissions are required
2532
# failing CI step may be sufficient to start (although it contains less information about why it failed)

0 commit comments

Comments
 (0)