Skip to content

Commit e37585a

Browse files
authored
Fix autolabel workflow again (TurboWarp#1883)
The heredoc's end delimiter needs to have no spaces before it. Easiest to just move it outside of the if statement.
1 parent 333a88a commit e37585a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

.github/workflows/label.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ jobs:
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
@@ -36,26 +56,6 @@ jobs:
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

0 commit comments

Comments
 (0)