Skip to content

Commit a474396

Browse files
authored
E2E tests: support running all tests on PRs (#7146)
Allow usage of `all` test tag. ### QA Notes
1 parent 9ee48f0 commit a474396

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

scripts/pr-e2e-comment.sh

100644100755
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ COMMENT_MARKER="$1" # e.g., "<!-- PR Tags -->"
1111
TAGS="$2" # e.g., "@:critical,@:quarto"
1212

1313
# Ensure required arguments are provided
14-
if [ -z "$COMMENT_MARKER" ] || [ -z "$TAGS" ]; then
14+
if [ -z "$COMMENT_MARKER" ]; then
1515
echo "Usage: $0 \"<comment_marker>\" \"<tags>\""
1616
exit 1
1717
fi
@@ -37,8 +37,12 @@ COMMENTS=$(gh api repos/${REPO}/issues/${PR_NUMBER}/comments --header "Authoriza
3737
# Check if a comment with the marker already exists
3838
COMMENT_ID=$(echo "$COMMENTS" | jq -r ".[] | select(.body | contains(\"$COMMENT_MARKER\")) | .id")
3939

40-
# Format the tags with individual backticks
41-
FORMATTED_TAGS=$(echo "$TAGS" | sed 's/,/` `/g' | sed 's/^/`/' | sed 's/$/`/')
40+
# Format the tags with individual backticks, or use default
41+
if [ -z "$TAGS" ]; then
42+
FORMATTED_TAGS="\`@:all\`"
43+
else
44+
FORMATTED_TAGS=$(echo "$TAGS" | sed 's/,/` `/g' | sed 's/^/`/' | sed 's/$/`/')
45+
fi
4246

4347
# Add the "🚨 RED ALERT!" note
4448
RED_ALERT_NOTE="<!-- \n🚨 RED ALERT! ✋ Rule breaker detected! Tags don’t go here, they belong above ^ in the PR description using this proper format: \`@:tag\`. Changing them here won't do anything (trust us, we’ve tried). Confused? Check out the README hyperlink.\n-->"

scripts/pr-tags-parse.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ PR_BODY=$(echo "$PULL_REQUEST_BODY" | tr '\n' ' ' | sed 's/"/\\"/g')
3131

3232
echo "Parsing tags from PR body..."
3333

34+
if echo "$PR_BODY" | grep -q "@:win"; then
35+
echo "Found win tag in PR body. Setting to run windows tests."
36+
echo "win_tag_found=true" >> "$GITHUB_OUTPUT"
37+
fi
38+
if echo "$PR_BODY" | grep -q "@:web"; then
39+
echo "Found web tag in PR body. Setting to run web tests."
40+
echo "web_tag_found=true" >> "$GITHUB_OUTPUT"
41+
fi
42+
3443
# Check if @:all is present in the PR body
3544
if echo "$PR_BODY" | grep -q "@:all"; then
3645
echo "Found @:all tag in PR body. Setting tags to run all tests."
3746
TAGS="" # Set to an empty string to indicate all tests should run
3847
else
39-
if echo "$PR_BODY" | grep -q "@:win"; then
40-
echo "Found win tag in PR body. Setting to run windows tests."
41-
echo "win_tag_found=true" >> "$GITHUB_OUTPUT"
42-
fi
43-
if echo "$PR_BODY" | grep -q "@:web"; then
44-
echo "Found web tag in PR body. Setting to run web tests."
45-
echo "web_tag_found=true" >> "$GITHUB_OUTPUT"
46-
fi
47-
4848
# Parse tags starting with '@:'
4949
TAGS=$(echo "$PR_BODY" | grep -o "@:[a-zA-Z0-9_-]*" | tr '\n' ',' | sed 's/,$//')
5050

@@ -56,10 +56,10 @@ else
5656
TAGS="@:critical"
5757
fi
5858
fi
59-
fi
6059

61-
# Output the tags
62-
echo "Extracted Tags: $TAGS"
60+
# Output the tags
61+
echo "Extracted Tags: $TAGS"
62+
fi
6363

6464
# Save tags to GITHUB_OUTPUT for use in GitHub Actions
6565
if [[ -n "$GITHUB_OUTPUT" ]]; then

0 commit comments

Comments
 (0)