11name : Update golangci-lint version
22
33on :
4+ pull_request :
5+ paths :
6+ - ' .github/workflows/update-golangci-lint.yaml'
47 schedule :
58 - cron : ' 0 0 * * 1' # Runs every Monday at midnight UTC
69 workflow_dispatch : # Allows manual triggering
@@ -13,30 +16,35 @@ jobs:
1316 uses : actions/checkout@v4
1417 with :
1518 fetch-depth : 0
16-
1719 - name : Get latest golangci-lint version
1820 id : get_version
1921 run : |
2022 LATEST_VERSION=$(curl -s https://api.github.com/repos/golangci/golangci-lint/releases/latest | jq -r .tag_name | sed 's/v//')
21- echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
22- echo "Latest version: $LATEST_VERSION"
23-
23+ echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
24+ echo "latest_version=${LATEST_VERSION}" >> "$GITHUB_OUTPUT"
2425 - name : Check current version in Makefile
2526 id : check_version
2627 run : |
2728 CURRENT_VERSION=$(grep 'GOLANGCI_LINT_VERSION' hack/tools/Makefile | cut -d '=' -f2 | tr -d ' ')
28- echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
29- echo "Current version: $CURRENT_VERSION"
30-
29+ echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"
3130 - name : Update Makefile if needed
32- if : env.CURRENT_VERSION != env.LATEST_VERSION
31+ if : ${{ steps.check_version.outputs.current_version != steps.get_version.outputs.latest_version }}
3332 run : |
34- sed -i "s/GOLANGCI_LINT_VERSION=.*/GOLANGCI_LINT_VERSION=${LATEST_VERSION}/" hack/tools/Makefile
35-
36- - uses : EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # tag=v9.1.4
37- name : Commit changes
33+ sed -i "s/GOLANGCI_LINT_VERSION=.*/GOLANGCI_LINT_VERSION=${{ steps.get_version.outputs.latest_version }}/" hack/tools/Makefile
34+ - name : Commit changes
35+ if : ${{ steps.check_version.outputs.current_version != steps.get_version.outputs.latest_version }}
36+ run : |
37+ git config --global user.name "github-actions[bot]"
38+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
39+ git checkout -b update-golangci-lint-${{ steps.get_version.outputs.latest_version }}
40+ git add hack/tools/Makefile
41+ git commit -m "chore: bump golangci-lint to v${{ steps.get_version.outputs.latest_version }}"
42+ git push origin update-golangci-lint-${{ steps.get_version.outputs.latest_version }}
43+ - name : Create Pull Request
44+ if : ${{ steps.check_version.outputs.current_version != steps.get_version.outputs.latest_version }}
45+ uses : peter-evans/create-pull-request@v6
3846 with :
39- author_name : github-actions[bot]
40- author_email : github-actions[bot]@users.noreply.github.com
41- default_author : github_actor
42- message : " chore: bump golangci-lint to v${LATEST_VERSION} "
47+ title : " 🌱 chore: bump golangci-lint to v${{ steps.get_version.outputs.latest_version }} "
48+ body : " This PR updates golangci-lint to version v${{ steps.get_version.outputs.latest_version }}. "
49+ branch : update-golangci-lint-${{ steps.get_version.outputs.latest_version }}
50+ labels : " area/dependency "
0 commit comments