refactor: (DSP-2004) Apply good practice to code #2
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 | |
on: | |
pull_request: | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π» Checkout current code ref | |
uses: actions/checkout@v4 | |
- name: π΅ Set up Go on runner | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: π¬ Run go formatting | |
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | |
- name: π· Run lint | |
uses: golangci/[email protected] | |
with: | |
version: v1.54 | |
commitlint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π» Checkout current code ref | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π’ Configure Node.js on runner | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.tool-versions' | |
- name: π§ Install dev dependencies | |
run: npm install --only=dev | |
# Check all commits pushed to this PR | |
- name: ποΈβπ¨οΈ Validate PR commits with commitlint | |
run: >- | |
npx commitlint | |
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} | |
--to ${{ github.event.pull_request.head.sha }} | |
--verbose | |
- name: π Validate PR title with commitlint | |
run: echo "${{ github.event.pull_request.title }}" | np |