Update major Go dependency versions #164
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
name: Update major Go dependency versions | |
# https://github.com/golang/go/issues/40323 | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 3 * * 1-5 | |
jobs: | |
go-major-dep-update: | |
runs-on: ubuntu-latest | |
permissions: {} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
token: "${{ secrets.RELEASE_TOKEN }}" | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version-file: "go.mod" | |
- name: Install gomajor | |
shell: bash | |
env: | |
VER: v0.12.0 | |
run: go install "github.com/icholy/gomajor@$VER" | |
- id: deps | |
shell: bash | |
env: | |
DIR: "." | |
PREFIX: " * " | |
run: | | |
{ | |
echo 'description<<_GitHubActionsFileCommandDelimiter_' | |
gomajor list -major -json | jq --arg p "$PREFIX" --slurp --raw-output '[.[].Latest.Path] | sort | $p + join("\n" + $p)' | |
echo '_GitHubActionsFileCommandDelimiter_' | |
} >> "$GITHUB_OUTPUT" | |
gomajor get -major all | |
go mod tidy | |
- run: echo "sum=$(md5sum ./go.mod | awk '{print $1}')" >> $GITHUB_OUTPUT | |
id: sum | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1 | |
id: commit | |
with: | |
create_branch: true | |
branch: "major-go-dep-update-${{ steps.sum.outputs.sum }}" | |
commit_message: | | |
Update major Go dependency versions | |
Update major version for: | |
${{ steps.deps.outputs.description }} | |
- name: Raise PR and close any old ones | |
if: steps.commit.outputs.changes_detected == 'true' | |
env: | |
GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" | |
PREFIX: "Update major Go dependency versions" | |
run: .github/raise-pr.sh |