Merge pull request #33 from duplocloud/release/0.5.6 #205
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Format | |
on: | |
pull_request: | |
push: | |
branches-ignore: | |
- master | |
- release/* | |
tags-ignore: | |
- v* | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
- | |
name: Run linting | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
only-new-issues: true # Only show new issues for pull requests. | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
- | |
name: Run formatting | |
run: gofmt -s -w duplocloud cmd/duplo-aws-credential-process | |
- | |
name: Check if formatting changed | |
id: git-check | |
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >>$GITHUB_OUTPUT | |
- | |
name: Commit formatting changes | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Duplo Github Bot' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git commit -am "lint: go fmt" | |
git push |