diff options
Diffstat (limited to '.github/workflows/lint.yml')
-rw-r--r-- | .github/workflows/lint.yml | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..2a643989 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,74 @@ +name: lint + +on: + workflow_call: + +jobs: + filter: + name: filter + runs-on: ubuntu-latest + outputs: + golang: ${{ steps.filter.outputs.golang }} + golang_files: ${{ steps.filter.outputs.golang_files }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + list-files: shell + filters: | + golang: + - added|modified: '**/*.go' + - added|modified: '/go.sum' + - added|modified: '/go.mod' + + codeql: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: go, javascript + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + + spelling: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check spelling + uses: codespell-project/actions-codespell@v2 + + go: + runs-on: ubuntu-latest + needs: + - filter + if: needs.filter.outputs.golang == 'true' + steps: + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: 1.22.5 + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check Code Formatting + run: | + test -z "$(gofmt -d ${{ needs.filter.outputs.golang_files }})" || exit 1 |