mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2026-05-04 22:26:11 +02:00
Apply principle of least privilege across all workflows:
- end-to-end-tests.yml: add missing permissions (contents: read)
- dependency-update.yaml: add missing permissions (contents: read)
- lint-test-chart.yaml: replace top-level read-all with permissions: {}
- release-chart.yaml: replace top-level read-all with permissions: {}
- codeql-analysis.yaml: remove unused actions: read
- lint.yaml: remove unused pull-requests: read
- staging-image-tester.yaml: remove unused checks: write (no goveralls step)
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
name: Lint
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
lint:
|
|
name: Markdown and Go
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
# Required: allow read access to the content for analysis.
|
|
contents: read
|
|
steps:
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
|
|
- name: Lint markdown
|
|
uses: nosborn/github-action-markdown-cli@508d6cefd8f0cc99eab5d2d4685b1d5f470042c1 # v3.5.0
|
|
with:
|
|
files: '.'
|
|
config_file: ".markdownlint.json"
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Go formatting
|
|
run: |
|
|
if [ -z "$(gofmt -l .)" ]; then
|
|
echo -e "All '*.go' files are properly formatted."
|
|
else
|
|
echo -e "Please run 'make go-lint' to fix. Some files need formatting:"
|
|
gofmt -d -l .
|
|
exit 1
|
|
fi
|
|
|
|
# https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#verify
|
|
- name: Verify linter configuration and Lint go code
|
|
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
|
|
with:
|
|
verify: true
|
|
args: --timeout=30m
|
|
version: v2.7
|
|
|
|
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
|
# https://github.com/pre-commit/action
|
|
- name: Verify with pre-commit
|
|
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|