From ba8a7622925e0a4d022aefc210da15140d45c361 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sun, 7 Dec 2025 13:07:42 +0000 Subject: [PATCH] Add go autoupdate workflow --- .github/workflows/go-autoupdate.yaml | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/go-autoupdate.yaml diff --git a/.github/workflows/go-autoupdate.yaml b/.github/workflows/go-autoupdate.yaml new file mode 100644 index 0000000..3de8d6b --- /dev/null +++ b/.github/workflows/go-autoupdate.yaml @@ -0,0 +1,59 @@ +name: Go Autoupdate + +on: + workflow_call: + inputs: + go-version: + description: "Go version to use" + required: false + type: string + default: ">=1.21" + release-workflow: + description: "Release workflow file to trigger (e.g., release.yml)" + required: false + type: string + default: "release.yml" + +jobs: + autoupdate: + name: Update dependencies and test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ inputs.go-version }} + cache: true + + - name: Update dependencies + run: | + go get -u ./... + go mod tidy + + - name: Run tests + run: go test -race -cover ./... + + - name: Commit changes + id: auto-commit + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Update go.mod and go.sum" + file_pattern: "go.mod go.sum" + + - name: Trigger release workflow + if: steps.auto-commit.outputs.changes_detected == 'true' + uses: actions/github-script@v7 + with: + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: '${{ inputs.release-workflow }}', + ref: 'main' + })