Skip to content

Commit b600404

Browse files
Copilotmbg
andcommitted
Clean up Go version workflow - remove unnecessary escaping and checks
Co-authored-by: mbg <278086+mbg@users.noreply.github.com>
1 parent cc7e03b commit b600404

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

.github/workflows/go-version-update.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Fetch latest Go version
3030
id: fetch-version
3131
run: |
32-
LATEST_GO_VERSION=$(curl -s https://go.dev/dl/\?mode\=json | jq -r '.[0].version')
32+
LATEST_GO_VERSION=$(curl -s https://go.dev/dl/?mode=json | jq -r '.[0].version')
3333
3434
if [ -z "$LATEST_GO_VERSION" ] || [ "$LATEST_GO_VERSION" = "null" ]; then
3535
echo "Error: Failed to fetch latest Go version from go.dev"
@@ -91,11 +91,9 @@ jobs:
9191
9292
echo "Updating from $CURRENT_VERSION to $LATEST_VERSION_NUM"
9393
94-
# Escape dots in version strings for use in sed patterns
94+
# Escape dots in current version strings for use in sed patterns
9595
CURRENT_VERSION_ESCAPED=$(echo "$CURRENT_VERSION" | sed 's/\./\\./g')
96-
LATEST_VERSION_NUM_ESCAPED=$(echo "$LATEST_VERSION_NUM" | sed 's/\./\\./g')
9796
CURRENT_MAJOR_MINOR_ESCAPED=$(echo "$CURRENT_MAJOR_MINOR" | sed 's/\./\\./g')
98-
LATEST_MAJOR_MINOR_ESCAPED=$(echo "$LATEST_MAJOR_MINOR" | sed 's/\./\\./g')
9997
10098
# Update MODULE.bazel
10199
if ! sed -i "s/go_sdk\.download(version = \"$CURRENT_VERSION_ESCAPED\")/go_sdk.download(version = \"$LATEST_VERSION_NUM\")/" MODULE.bazel; then
@@ -144,7 +142,7 @@ jobs:
144142
BRANCH_NAME="workflow/go-version-update"
145143
PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --state open --json number --jq '.[0].number')
146144
147-
if [ "$PR_NUMBER" != "null" ] && [ -n "$PR_NUMBER" ]; then
145+
if [ -n "$PR_NUMBER" ]; then
148146
echo "Existing PR found: #$PR_NUMBER"
149147
echo "pr_exists=true" >> $GITHUB_OUTPUT
150148
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)