File tree Expand file tree Collapse file tree 1 file changed +20
-20
lines changed
Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Original file line number Diff line number Diff line change 2828 LABEL_CHANGE_EXTENSION="pr: change existing extension"
2929 LABEL_OTHER="pr: other"
3030
31+ # grep doesn't have good multiline support and installing pcregrep through apt is slow, so
32+ # make our own tiny regex checker tool.
33+ cat > matches <<EOF
34+ #!/usr/bin/env python3
35+ import sys
36+ import re
37+
38+ pattern = sys.argv[1]
39+ file = sys.argv[2]
40+
41+ with open(file, 'r') as f:
42+ contents = f.read()
43+
44+ if re.search(pattern, contents, re.MULTILINE):
45+ sys.exit(0)
46+ else:
47+ sys.exit(1)
48+ EOF
49+ chmod +x matches
50+
3151 got_any_specific_label=false
3252
3353 if [[ "$BASE_REF" == "master" ]]; then
3656 # Download just the diff so it is harder to accidentally run any code from the pull request.
3757 gh pr diff --repo "$GH_REPO" "$PR_NUMBER" | tee pr.diff
3858
39- # grep doesn't have good multiline support and installing pcregrep through apt is slow, so
40- # make our own tiny regex checker tool.
41- cat > matches <<EOF
42- #!/usr/bin/env python3
43- import sys
44- import re
45-
46- pattern = sys.argv[1]
47- file = sys.argv[2]
48-
49- with open(file, 'r') as f:
50- contents = f.read()
51-
52- if re.search(pattern, contents, re.MULTILINE):
53- sys.exit(0)
54- else:
55- sys.exit(1)
56- EOF
57- chmod +x matches
58-
5959 if ./matches "^--- /dev/null\n\+\+\+ b/extensions/" pr.diff; then
6060 # Example:
6161 # --- /dev/null
You can’t perform that action at this time.
0 commit comments