-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into apply-changes-force-latest-variables-flag
- Loading branch information
Showing
9 changed files
with
225 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ concurrency: Upgrade Golang 2 | |
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * 1' | ||
|
||
jobs: | ||
upgrade-golang: | ||
|
@@ -17,8 +19,67 @@ jobs: | |
shell: bash | ||
|
||
steps: | ||
- name: Checkout Om | ||
- id: checkout-om | ||
name: Checkout Om | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
path: om | ||
|
||
- id: setup-go | ||
name: Set Go to latest | ||
uses: actions/setup-go@v5 | ||
with: | ||
check-latest: true | ||
|
||
- id: upgrade-golang | ||
name: Upgrade Golang | ||
working-directory: om | ||
run: | | ||
version=$(go version | awk '{print $3}' | sed 's/go//') | ||
echo "Current go version: $version" | ||
go mod edit -go=$version | ||
go get -u -t ./... | ||
go mod tidy | ||
- id: install-gh-cli | ||
name: Install GH CLI | ||
uses: dev-hanz-ops/[email protected] | ||
with: | ||
gh-cli-version: 2.43.1 | ||
|
||
- id: commit-changes-and-create-pr | ||
name: Commit changes and create PR | ||
working-directory: om | ||
run: | | ||
set -x | ||
branch_suffix=$(echo "${GITHUB_SHA}" | cut -c1-7) | ||
branch_name="tmp/upgrade-golang-${branch_suffix}" | ||
if git show-ref --verify --quiet "refs/remotes/origin/${branch_name}"; then | ||
echo "Branch ${branch_name} already exists. Exiting..." | ||
exit 0 | ||
fi | ||
if gh pr list --search "Upgrade Golang in:title" | grep -q "Upgrade Golang"; then | ||
echo "PR with title 'Upgrade Golang' already exists. Exiting..." | ||
exit 0 | ||
fi | ||
files_changed=$(git status --porcelain) | ||
if [[ -z ${files_changed} ]]; then | ||
echo "No changes to detected. Exiting..." | ||
exit 0 | ||
fi | ||
git config --global url.https://${GITHUB_TOKEN}@github.com/.insteadOf https://github.com/ | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "tas-operability-bot" | ||
git checkout -b ${branch_name} | ||
git add . | ||
git commit -m "Upgrade Golang" | ||
git push --set-upstream origin ${branch_name} | ||
gh pr create --title "Upgrade Golang" --body "Upgrade Golang" --base main --head ${branch_name} | ||
gh pr merge ${branch_name} --auto --rebase --delete-branch | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TAS_OPERABILITY_BOT_OM_REPO_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.