Skip to content

Commit 5c2a922

Browse files
FIX: @W-18667129@: Remove local github action since it is getting fla… (#1829)
1 parent be34d94 commit 5c2a922

18 files changed

+35
-32296
lines changed

.github/workflows/validate-pr.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,39 @@ jobs:
2020
# Private actions must check out repo first.
2121
- name: Checkout
2222
uses: actions/checkout@v4
23-
- name: Verify PR title
24-
uses: ./github-actions/verify-pr-title
25-
id: verify_pr_title
23+
- name: Verify PR Title
24+
run: |
25+
title="${{ github.event.pull_request.title }}"
26+
title_upper=$(echo "$title" | tr '[:lower:]' '[:upper:]')
27+
base_ref="${{ github.base_ref }}"
28+
29+
# Define regex patterns for different types of PR titles
30+
MAIN2DEV_REGEX="^MAIN2DEV[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.*MERGING.+[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2}.*"
31+
RELEASE2MAIN_REGEX="^RELEASE[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+"
32+
PR_INTO_DEV_OR_RELEASE_REGEX="^(FIX|CHANGE|NEW)([[:space:]]*\([^)]+\))?[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+"
33+
34+
# Validate PR title based on base_ref and head_ref
35+
if [[ "$base_ref" == "dev" && "${{ startsWith(github.head_ref, 'm2d/') }}" == "true" ]]; then
36+
if [[ ! "$title_upper" =~ $MAIN2DEV_REGEX ]]; then
37+
echo "::error::Invalid PR title: '$title'. Please follow the format: Main2Dev @W-XXXXXXXX@ Merging.*\d+\.\d+\.\d+"
38+
exit 1
39+
fi
40+
elif [[ "$base_ref" == "main" ]]; then
41+
if [[ ! "$title_upper" =~ $RELEASE2MAIN_REGEX ]]; then
42+
echo "::error::Invalid PR title: '$title'. Please follow the format: RELEASE @W-XXXXXXXX@ Summary"
43+
exit 1
44+
fi
45+
elif [[ "$base_ref" == "dev" || "${{ startsWith(github.base_ref, 'release-') }}" == "true" ]]; then
46+
if [[ ! "$title_upper" =~ $PR_INTO_DEV_OR_RELEASE_REGEX ]]; then
47+
echo "::error::Invalid PR title: '$title'. Please follow the format: FIX|CHANGE|NEW (__) @W-XXXXXXXX@ Summary"
48+
exit 1
49+
fi
50+
else
51+
echo "PR title '$title' automatically accepted for $base_ref branch."
52+
fi
53+
54+
# If no errors, print success
55+
echo "Valid PR title: '$title'"
2656
# Separately, we also need to run all of our tests.
2757
run_tests:
2858
uses: ./.github/workflows/run-tests.yml

github-actions/verify-pr-title/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

github-actions/verify-pr-title/.eslintrc.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

github-actions/verify-pr-title/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

github-actions/verify-pr-title/README.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

github-actions/verify-pr-title/action.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)