Skip to content

Commit 7227a25

Browse files
Merge pull request #69 from VirdocsSoftware/release/v2.9.0
release v2.9.0 to main
2 parents 8b2f94f + c28ad85 commit 7227a25

3 files changed

Lines changed: 86 additions & 19 deletions

File tree

.github/actions/validate-pr/validate_pr.sh

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
#!/bin/bash
22

33
if [ "$PR_TITLE" == "" ]; then
4-
echo "env variable PR_TITLE is required"
4+
echo "Error: Missing required environment variable PR_TITLE
5+
Action: Please set the PR_TITLE environment variable."
56
exit 1
67
fi
78
if [ "$PR_BRANCH" == "" ]; then
8-
echo "env variable PR_BRANCH is required"
9+
echo "Error: Missing required environment variable PR_BRANCH
10+
Action: Please set the PR_BRANCH environment variable."
911
exit 1
1012
fi
1113
if [ "$LATEST_RELEASE" == "" ]; then
12-
echo "env variable LATEST_RELEASE is required"
14+
echo "Error: Missing required environment variable LATEST_RELEASE
15+
Action: Please set the LATEST_RELEASE environment variable."
1316
exit 1
1417
fi
1518
if [ "$PACKAGE_VERSION" == "" ]; then
16-
echo "env variable PACKAGE_VERSION is required"
19+
echo "Error: Missing required environment variable PACKAGE_VERSION
20+
Action: Please set the PACKAGE_VERSION environment variable."
1721
exit 1
1822
fi
1923
if [ "$TARGET_BRANCH" == "" ]; then
20-
echo "env variable TARGET_BRANCH is required"
24+
echo "Error: Missing required environment variable TARGET_BRANCH
25+
Action: Please set the TARGET_BRANCH environment variable."
2126
exit 1
2227
fi
2328

@@ -69,31 +74,63 @@ if [[ "$TARGET_BRANCH" == "develop" ]] || [[ "$TARGET_BRANCH" =~ ^release/v ]] |
6974
exit 0
7075
fi
7176
if [[ ! "$PR_TITLE" =~ $SEMANTIC_PREFIXES ]]; then
72-
echo "PR title must start with a valid semantic prefix (e.g., feat:, fix:)."
77+
echo "Error: Invalid PR title format
78+
Details:
79+
- Current title: $PR_TITLE
80+
Action: Update the PR title to start with a valid semantic prefix
81+
Valid prefixes: feat:, fix:, chore:, docs:, style:, refactor:, perf:, test:
82+
Example: feat: Add new feature (ABC-123)"
7383
exit 1
7484
fi
7585

7686
if [[ ! "$PR_TITLE" =~ $JIRA_TICKET ]]; then
77-
echo "PR title must contain a valid Jira ticket ID (e.g., ABC-123)."
87+
echo "Error: Missing Jira ticket reference in PR title
88+
Details:
89+
- Current title: $PR_TITLE
90+
Action: Include a Jira ticket ID in the PR title using the format (ABC-123)
91+
Example: feat: Add new feature (ABC-123)"
7892
exit 1
7993
fi
8094
fi
8195

8296
if [[ "$TARGET_BRANCH" == "main" ]]; then
8397
if [[ "$PR_BRANCH" =~ ^release/v ]] || [[ "$PR_BRANCH" =~ ^hotfix/v ]]; then
8498
if [[ ! "$PR_BRANCH" =~ ^release/v$PACKAGE_VERSION ]] && [[ ! "$PR_BRANCH" =~ ^hotfix/v$PACKAGE_VERSION ]]; then
85-
echo "PR branch and package version must match"
99+
echo "Error: Mismatch between the pull request branch and the package version.
100+
Details:
101+
- PR Branch: $PR_BRANCH
102+
- Latest Release: $LATEST_RELEASE
103+
- Package Version: $PACKAGE_VERSION
104+
Action: Update the PR branch name or package version to ensure consistency.
105+
For more details on naming conventions, refer to our workflow documentation.
106+
See: https://virdocs.atlassian.net/wiki/x/AYAqHAE"
86107
exit 1
87108
elif [ "$(compare_versions $PACKAGE_VERSION $LATEST_RELEASE)" != "1" ]; then
88-
echo "Next predicted version must be higher than the latest release."
109+
echo "Error: Invalid version increment
110+
Details:
111+
- Current version: $PACKAGE_VERSION
112+
- Latest release: $LATEST_RELEASE
113+
Action: Update the package version to be higher than the latest release
114+
Example: If latest is 1.0.0, next version should be > 1.0.0 (e.g., 1.0.1, 1.1.0, 2.0.0)
115+
For version numbering guidelines, see: https://semver.org/"
89116
exit 1
90117
fi
91118
else
92-
echo "PR branch must be release/v$PACKAGE_VERSION or hotfix/v$PACKAGE_VERSION"
119+
echo "Error: Invalid branch name for main target
120+
Details:
121+
- Current branch: $PR_BRANCH
122+
- Target branch: main
123+
Action: Only release or hotfix branches can be merged to main
124+
Expected format: release/v$PACKAGE_VERSION or hotfix/v$PACKAGE_VERSION"
93125
exit 1
94126
fi
95127
if [[ ! "$PR_BRANCH" =~ ^release/v$PACKAGE_VERSION ]] && [[ ! "$PR_BRANCH" =~ ^hotfix/v$PACKAGE_VERSION ]]; then
96-
echo "PR branch must be release/v$PACKAGE_VERSION or hotfix/v$PACKAGE_VERSION"
128+
echo "Error: Branch name does not match package version
129+
Details:
130+
- Current branch: $PR_BRANCH
131+
- Package version: $PACKAGE_VERSION
132+
Action: Rename branch to match package version
133+
Expected format: release/v$PACKAGE_VERSION or hotfix/v$PACKAGE_VERSION"
97134
exit 1
98135
fi
99136
fi

.github/actions/validate-pr/validate_pr_test.sh

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#!/bin/bash
32

43
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
@@ -38,7 +37,12 @@ ACTUAL="$($SCRIPT_DIR/validate_pr.sh)"
3837

3938
# THEN
4039
expect "$?" "1"
41-
expect "$ACTUAL" "PR title must start with a valid semantic prefix (e.g., feat:, fix:)."
40+
expect "$ACTUAL" "Error: Invalid PR title format
41+
Details:
42+
- Current title: This is a PR title (ISSUE-1234)
43+
Action: Update the PR title to start with a valid semantic prefix
44+
Valid prefixes: feat:, fix:, chore:, docs:, style:, refactor:, perf:, test:
45+
Example: feat: Add new feature (ABC-123)"
4246

4347
echo Scenario: PR title missing Jira ticket for feature branch
4448
beforeEach
@@ -51,7 +55,11 @@ ACTUAL="$($SCRIPT_DIR/validate_pr.sh)"
5155

5256
# THEN
5357
expect "$?" "1"
54-
expect "$ACTUAL" "PR title must contain a valid Jira ticket ID (e.g., ABC-123)."
58+
expect "$ACTUAL" "Error: Missing Jira ticket reference in PR title
59+
Details:
60+
- Current title: feat: This is a PR title
61+
Action: Include a Jira ticket ID in the PR title using the format (ABC-123)
62+
Example: feat: Add new feature (ABC-123)"
5563

5664
echo Scenario: PR title missing Jira ticket for feature branch targeting hotfix branch
5765
beforeEach
@@ -64,7 +72,11 @@ ACTUAL="$($SCRIPT_DIR/validate_pr.sh)"
6472

6573
# THEN
6674
expect "$?" "1"
67-
expect "$ACTUAL" "PR title must contain a valid Jira ticket ID (e.g., ABC-123)."
75+
expect "$ACTUAL" "Error: Missing Jira ticket reference in PR title
76+
Details:
77+
- Current title: feat: This is a PR title
78+
Action: Include a Jira ticket ID in the PR title using the format (ABC-123)
79+
Example: feat: Add new feature (ABC-123)"
6880

6981
echo Scenario: Valid PR title for feature branch
7082
beforeEach
@@ -91,7 +103,12 @@ ACTUAL="$($SCRIPT_DIR/validate_pr.sh)"
91103

92104
# THEN
93105
expect "$?" "1"
94-
expect "$ACTUAL" "PR branch must be release/v1.1.0 or hotfix/v1.1.0"
106+
expect "$ACTUAL" "Error: Invalid branch name for main target
107+
Details:
108+
- Current branch: TICKET-123
109+
- Target branch: main
110+
Action: Only release or hotfix branches can be merged to main
111+
Expected format: release/v1.1.0 or hotfix/v1.1.0"
95112

96113
echo Scenario: Package version and branch name mismatch
97114
beforeEach
@@ -106,7 +123,14 @@ ACTUAL="$($SCRIPT_DIR/validate_pr.sh)"
106123

107124
# THEN
108125
expect "$?" "1"
109-
expect "$ACTUAL" "PR branch and package version must match"
126+
expect "$ACTUAL" "Error: Mismatch between the pull request branch and the package version.
127+
Details:
128+
- PR Branch: release/v1.1.0
129+
- Latest Release: 1.0.0
130+
- Package Version: 1.0.0
131+
Action: Update the PR branch name or package version to ensure consistency.
132+
For more details on naming conventions, refer to our workflow documentation.
133+
See: https://virdocs.atlassian.net/wiki/x/AYAqHAE"
110134

111135
echo Scenario: Next Release version is not higher than the latest version
112136
beforeEach
@@ -121,7 +145,13 @@ ACTUAL="$($SCRIPT_DIR/validate_pr.sh)"
121145

122146
# THEN
123147
expect "$?" "1"
124-
expect "$ACTUAL" "Next predicted version must be higher than the latest release."
148+
expect "$ACTUAL" "Error: Invalid version increment
149+
Details:
150+
- Current version: 1.0.0
151+
- Latest release: 1.0.0
152+
Action: Update the package version to be higher than the latest release
153+
Example: If latest is 1.0.0, next version should be > 1.0.0 (e.g., 1.0.1, 1.1.0, 2.0.0)
154+
For version numbering guidelines, see: https://semver.org/"
125155

126156
echo Scenario: Valid feature branch to develop branch
127157
beforeEach

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-actions",
3-
"version": "2.8.3",
3+
"version": "2.9.0",
44
"description": "Used to store GitHub actions for use across the enterprise",
55
"scripts": {
66
"test": "./tooling/scripts/run_tests.sh",

0 commit comments

Comments
 (0)