Skip to content

Commit 37b1452

Browse files
authored
Fix for update protos action (#39)
1 parent 6bddd21 commit 37b1452

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

.github/workflows/update-protos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
required: true
99
type: string
1010
sdk_version:
11-
description: 'SDK version to set (e.g., 0.7.0). Use the version that is intended for the next release.'
12-
required: true
11+
description: 'SDK version to set (e.g., 0.7.0). Use the version that is intended for the next release. If not specified, the sdk version will not be updated.'
12+
required: false
1313
type: string
1414
branch_name:
1515
description: 'Branch name for the PR (default: auto-generated)'

scripts/update-protos.sh

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,36 +84,46 @@ parse_args() {
8484
case $1 in
8585
-r|--release-version)
8686
RELEASE_VERSION="$2"
87-
if ! validate_version "$RELEASE_VERSION"; then
88-
log_error "Invalid release version format: $RELEASE_VERSION"
89-
log_error "Expected format: v1.2.3 or 1.2.3 (with optional pre-release suffix)"
90-
exit 1
87+
# Allow empty value to fallback to no set
88+
if [[ -n "$RELEASE_VERSION" ]]; then
89+
if ! validate_version "$RELEASE_VERSION"; then
90+
log_error "Invalid release version format: $RELEASE_VERSION"
91+
log_error "Expected format: v1.2.3 or 1.2.3 (with optional pre-release suffix)"
92+
exit 1
93+
fi
9194
fi
9295
shift 2
9396
;;
9497
-s|--sdk-version)
9598
SDK_VERSION="$2"
96-
if ! validate_version "$SDK_VERSION"; then
97-
log_error "Invalid SDK version format: $SDK_VERSION"
98-
log_error "Expected format: v1.2.3 or 1.2.3 (with optional pre-release suffix)"
99-
exit 1
99+
# Allow empty value to fallback to no set
100+
if [[ -n "$SDK_VERSION" ]]; then
101+
if ! validate_version "$SDK_VERSION"; then
102+
log_error "Invalid SDK version format: $SDK_VERSION"
103+
log_error "Expected format: v1.2.3 or 1.2.3 (with optional pre-release suffix)"
104+
exit 1
105+
fi
100106
fi
101107
shift 2
102108
;;
103109
-b|--branch-name)
104110
BRANCH_NAME="$2"
105-
if ! validate_branch_name "$BRANCH_NAME"; then
106-
log_error "Invalid branch name format: $BRANCH_NAME"
107-
log_error "Branch name must be alphanumeric with dashes, underscores, slashes, or dots"
108-
exit 1
111+
# Allow empty value to fallback to no set (auto-generated)
112+
if [[ -n "$BRANCH_NAME" ]]; then
113+
if ! validate_branch_name "$BRANCH_NAME"; then
114+
log_error "Invalid branch name format: $BRANCH_NAME"
115+
log_error "Branch name must be alphanumeric with dashes, underscores, slashes, or dots"
116+
exit 1
117+
fi
109118
fi
110119
shift 2
111120
;;
112121
-t|--pr-title)
113122
PR_TITLE="$2"
114-
# Validate PR title is not empty and doesn't contain dangerous characters
115-
if [[ -z "$PR_TITLE" ]] || [[ "$PR_TITLE" =~ [\`\$\(\)] ]]; then
116-
log_error "Invalid PR title: contains dangerous characters or is empty"
123+
# Allow empty value to fallback to no set (auto-generated)
124+
# Validate PR title doesn't contain dangerous characters if provided
125+
if [[ -n "$PR_TITLE" ]] && [[ "$PR_TITLE" =~ [\`\$\(\)] ]]; then
126+
log_error "Invalid PR title: contains dangerous characters"
117127
exit 1
118128
fi
119129
shift 2

0 commit comments

Comments
 (0)