Skip to content

Commit 74a5888

Browse files
authored
Merge pull request #2450 from shiftstack/update-golangci-lint
🌱 ci: add GH workflow to automate golangci-lint bumps
2 parents b4b5c29 + f443c37 commit 74a5888

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update golangci-lint version
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 1' # Runs every Monday at midnight UTC
6+
workflow_dispatch: # Allows manual triggering
7+
8+
jobs:
9+
update-golangci-lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Get latest golangci-lint version
18+
id: get_version
19+
run: |
20+
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+
24+
- name: Check current version in Makefile
25+
id: check_version
26+
run: |
27+
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+
31+
- name: Update Makefile if needed
32+
if: env.CURRENT_VERSION != env.LATEST_VERSION
33+
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
38+
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}"

0 commit comments

Comments
 (0)