Skip to content

Commit 5f99c4d

Browse files
authored
Update update-deps.yml update-go-version job
Fix issue when creating PR after update the go version.
1 parent ba355ee commit 5f99c4d

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

.github/workflows/update-deps.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,28 @@ jobs:
7373
replace: "FROM golang:${{ steps.go-version.outputs.latest_go_version }}-bookworm as builder-base"
7474
path: "Dockerfile"
7575

76-
- name: Commit and push changes (optional)
77-
uses: stefanzweifel/git-auto-commit-action@v4
76+
- name: Check if Go version was updated
77+
id: check-changes
78+
run: |
79+
if [[ ${{ steps.current-go-version.outputs.current_go_version }} != ${{ steps.go-version.outputs.latest_go_version }} ]]; then
80+
echo "changes=true" >> $GITHUB_OUTPUT
81+
else
82+
echo "changes=false" >> $GITHUB_OUTPUT
83+
fi
84+
85+
- name: Create Pull Request
86+
if: ${{ steps.check-changes.outputs.changes == 'true' }} # Only create PR if there were changes
87+
uses: peter-evans/create-pull-request@v6
7888
with:
79-
commit_message: "Update Go version in Dockerfile"
89+
title: 'Update Go version in Dockerfile'
90+
commit-message: 'Update Go version in Dockerfile'
91+
committer: github-actions <[email protected]>
92+
author: github-actions <[email protected]>
93+
branch: go-version-update # Choose a suitable branch name
94+
branch-suffix: timestamp
95+
base: master
96+
delete-branch: true
97+
labels: ok-to-test
98+
body: |
99+
This PR updates the Go version in the Dockerfile to ${{ steps.go-version.outputs.latest_go_version }}.
80100

0 commit comments

Comments
 (0)