Skip to content

Commit 04ede4e

Browse files
FEATURE/HCMPRE-1 Updated the rules (#2003)
* Update README.md * Update branch-name-check.yml * Update branch-name-check.yml * Update branch-name-check.yml
1 parent ca7b0cc commit 04ede4e

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.github/workflows/branch-name-check.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,23 @@ jobs:
2020
uses: actions/checkout@v3
2121

2222
- name: Validate branch name
23-
if: ${{ github.event_name != 'pull_request' }} # Skip for PR validation
2423
run: |
25-
# Define constants
24+
# Determine the branch name
25+
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
26+
branch_name="${GITHUB_HEAD_REF}"
27+
else
28+
branch_name="${GITHUB_REF#refs/heads/}"
29+
fi
30+
31+
# Define the branch name pattern
2632
PREFIXES="FEATURE|BUGFIX|RELEASE"
27-
SYSTEMS="HCMPRE|DPG|SN"
33+
PROJECTS="HCMPRE|DPG|SN"
2834
TICKET_PATTERN="[0-9]{1,5}"
29-
BRANCH_PATTERN="^($PREFIXES)\/($SYSTEMS)-$TICKET_PATTERN$"
30-
31-
# Determine the branch name
32-
branch_name="${GITHUB_REF#refs/heads/}"
33-
35+
BRANCH_PATTERN="^($PREFIXES)\/($PROJECTS)-$TICKET_PATTERN$"
36+
3437
# Validate the branch name
3538
if [[ ! "$branch_name" =~ $BRANCH_PATTERN ]]; then
36-
echo "Branch name '$branch_name' does not follow the correct pattern: $PREFIXES/$SYSTEMS-<TICKET_NO> where <TICKET_NO> is $TICKET_PATTERN"
39+
echo "Branch name '$branch_name' does not follow the correct pattern: $PREFIXES/$PROJECTS-<TICKET_NO> where <TICKET_NO> is $TICKET_PATTERN"
3740
exit 1
3841
fi
3942

@@ -42,15 +45,15 @@ jobs:
4245
run: |
4346
# Define constants
4447
PREFIXES="FEATURE|BUGFIX|RELEASE"
45-
SYSTEMS="HCMPRE|DPG|SN"
48+
PROJECTS="HCMPRE|DPG|SN"
4649
TICKET_PATTERN="[0-9]{1,5}"
47-
TITLE_PATTERN="^($PREFIXES)\/($SYSTEMS)-$TICKET_PATTERN: .+$"
50+
TITLE_PATTERN="^($PREFIXES)\/($PROJECTS)-$TICKET_PATTERN .+$"
4851
4952
# Get the PR title
5053
pr_title="${{ github.event.pull_request.title }}"
5154
5255
# Validate the PR title
5356
if [[ ! "$pr_title" =~ $TITLE_PATTERN ]]; then
54-
echo "PR title '$pr_title' does not follow the correct pattern: $PREFIXES/$SYSTEMS-<TICKET_NO>: <Description> where <TICKET_NO> is $TICKET_PATTERN"
57+
echo "PR title '$pr_title' does not follow the correct pattern: $PREFIXES/$PROJECTS-<TICKET_NO>: <Description> where <TICKET_NO> is $TICKET_PATTERN"
5558
exit 1
5659
fi

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ For support, add the issues in https://github.com/egovernments/DIGIT-core/issues
106106
4. Dashboard
107107
5. Engagement
108108
6. Payment
109+
109110

110111
## Starting with Digit-UI App (Impelmentation Teams) - MICRO-UI
111112

0 commit comments

Comments
 (0)