Skip to content

Merge pull request #333 from robinje/dependabot/pip/requirements/nump… #782

Merge pull request #333 from robinje/dependabot/pip/requirements/nump…

Merge pull request #333 from robinje/dependabot/pip/requirements/nump… #782

name: Go Format and Check
on:
push:
branches: [develop, qa, prod]
pull_request:
branches: "**"
permissions:
pull-requests: write
contents: write
jobs:
format-and-check:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Configure Git
run: |
git fetch -q
git checkout ${{github.head_ref}} --progress
git config --global user.name 'Dark Relics Automatic'
git config --global user.email '[email protected]'
git pull
- name: Format and check code
run: |
echo "Processing directory"
cd server
go mod download
go fmt ./...
go mod tidy
go mod verify
go vet ./...
govulncheck ./...
cd ..
- name: Check for changes
id: git-check
run: |
git add . -v
if git diff-index --quiet HEAD; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.git-check.outputs.changes == 'true'
run: |
git commit -m "Apply formatting and update dependencies" --allow-empty
git push -v