From 3a11df332de1751618915cf7daeefe5f4346a8c7 Mon Sep 17 00:00:00 2001 From: gitworkflows <118260833+gitworkflows@users.noreply.github.com> Date: Sun, 24 Nov 2024 02:07:49 +0600 Subject: [PATCH] Create lint-fix.yml Signed-off-by: gitworkflows <118260833+gitworkflows@users.noreply.github.com> --- .github/workflows/lint-fix.yml | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/lint-fix.yml diff --git a/.github/workflows/lint-fix.yml b/.github/workflows/lint-fix.yml new file mode 100644 index 0000000..f5595ae --- /dev/null +++ b/.github/workflows/lint-fix.yml @@ -0,0 +1,43 @@ +name: 🙏🏻 Lint Test + +on: + push: + tags: + - v* + branches: + - master + - main + pull_request: + paths: + - '**/*.go' # Only run on Go files +permissions: + contents: write # Write permission needed for autofix + pull-requests: write + +jobs: + golangci: + name: Run golangci-lint with Autofix + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required for creating commits in the repo + - uses: actions/setup-go@v3 + with: + go-version-file: go.mod + cache: true + cache-dependency-path: go.sum + - uses: golangci/golangci-lint-action@v3 + with: + version: v1.52 + cache: true + skip-cache: false + args: --fix --timeout 10m --verbose + - name: Commit and Push Changes + if: success() # Only push changes if the linting succeeds + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Autofix: Applied golangci-lint fixes" + git push