Add pr number scripts #3940
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: lints | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash -euo pipefail {0} | |
jobs: | |
golangci: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- uses: golangci/golangci-lint-action@v6 | |
with: | |
# Required: the version of golangci-lint is required and | |
# should be specified with patch version. | |
version: v1.60.3 | |
args: --timeout 5m | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
check-go-mod-tidy: | |
name: check go mod tidy | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: go mod tidy | |
run: | | |
go mod tidy | |
- name: check diff | |
run: | | |
if ! test -z "$(git ls-files --exclude-standard --others .)$(git diff .)"; then | |
git ls-files --exclude-standard --others . | |
git diff . | |
echo "ERROR: 'go mod tidy' modified the source tree." | |
exit 1 | |
fi | |
generated: | |
name: check generated files | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: make generate | |
run: | | |
make generate | |
- name: check diff | |
run: | | |
if ! test -z "$(git ls-files --exclude-standard --others .)$(git diff .)"; then | |
git ls-files --exclude-standard --others . | |
git diff . | |
echo "ERROR: 'make generate' modified the source tree." | |
exit 1 | |
fi | |
codespell: | |
name: check spelling with codespell | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2.1 | |
with: | |
check_hidden: true | |
ignore_words_list: NotIn # k8s match selectors; codespell tries to correct it to 'noting', 'not in', or 'notion' | |
skip: go.sum,./cluster-autoscaler/ca.patch,./neonvm/config/multus-common/nad-crd.yaml | |
actionlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: reviewdog/action-actionlint@eaf7d6d28c81a1965d0a848128dde7c42f726097 # v1.54.0 | |
env: | |
# SC2046 - Quote this to prevent word splitting. - https://www.shellcheck.net/wiki/SC2046 | |
# SC2086 - Double quote to prevent globbing and word splitting. - https://www.shellcheck.net/wiki/SC2086 | |
SHELLCHECK_OPTS: --exclude=SC2046,SC2086 | |
with: | |
fail_on_error: true | |
filter_mode: nofilter | |
level: error |