Skip to content

🌱 Fix workflows/update-golangci-lint #14

🌱 Fix workflows/update-golangci-lint

🌱 Fix workflows/update-golangci-lint #14

name: Update golangci-lint version
on:
pull_request:
paths:
- '.github/workflows/update-golangci-lint.yaml'
schedule:
- cron: '0 0 * * 1' # Runs every Monday at midnight UTC
workflow_dispatch: # Allows manual triggering
permissions:
pull-requests: write
jobs:
update-golangci-lint:
runs-on: ubuntu-latest
outputs:
latest_version: ${{ steps.get_version.outputs.latest_version }}
current_version: ${{ steps.check_version.outputs.current_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest golangci-lint version
id: get_version
run: |
export LATEST_VERSION=$(curl -s https://api.github.com/repos/golangci/golangci-lint/releases/latest | jq -r .tag_name)
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_OUTPUT
- name: Check current version in Makefile
id: check_version
run: |
export CURRENT_VERSION=$(grep 'GOLANGCI_LINT_VERSION ?=' hack/tools/Makefile | cut -d '=' -f2 | tr -d ' ')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
- name: Update Makefile if needed
run: |
sed -i "s/GOLANGCI_LINT_VERSION ?= .*/GOLANGCI_LINT_VERSION ?= ${{ steps.get_version.outputs.latest_version }}/" hack/tools/Makefile
sed -i "s/GOLANGCI_LINT_VERSION ?= .*/GOLANGCI_LINT_VERSION ?= foo/" hack/tools/Makefile
- name: Create Pull Request
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # tag=v7.0.7
with:
commit-message: "This commit updates golangci-lint to version v${{ steps.get_version.outputs.latest_version }}."
title: ":seedling: chore: bump golangci-lint to v${{ steps.get_version.outputs.latest_version }}"
body: "This PR updates golangci-lint to version v${{ steps.get_version.outputs.latest_version }}."
branch: update-golangci-lint-${{ steps.get_version.outputs.latest_version }}
labels: "area/dependency"
add-paths: |
- hack/tools/Makefile