mirror of
https://github.com/ko-build/ko.git
synced 2026-06-18 20:14:08 +02:00
* [ci] upgrade to go 1.17 everywhere * remove unnecessary step names and shell:bash gofmt with Go v1.17 * add boilerplate to hack/tools.go
71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
name: Boilerplate
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ['main']
|
|
|
|
jobs:
|
|
|
|
check:
|
|
name: Boilerplate Check
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false # Keep running if one leg fails.
|
|
matrix:
|
|
extension:
|
|
- go
|
|
- sh
|
|
|
|
# Map between extension and human-readable name.
|
|
include:
|
|
- extension: go
|
|
language: Go
|
|
- extension: sh
|
|
language: Bash
|
|
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17.x
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Tools
|
|
run: |
|
|
TEMP_PATH="$(mktemp -d)"
|
|
cd $TEMP_PATH
|
|
|
|
echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
|
|
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" 2>&1
|
|
echo '::endgroup::'
|
|
|
|
echo '::group:: Installing boilerplate-check ... https://github.com/mattmoor/boilerplate-check'
|
|
go get github.com/mattmoor/boilerplate-check/cmd/boilerplate-check
|
|
echo '::endgroup::'
|
|
|
|
echo "${TEMP_PATH}" >> $GITHUB_PATH
|
|
|
|
- name: ${{ matrix.language }} license boilerplate
|
|
shell: bash
|
|
env:
|
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -e
|
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
|
|
|
echo '::group:: Running github.com/mattmoor/boilerplate-check for ${{ matrix.language }} with reviewdog 🐶 ...'
|
|
# Don't fail because of boilerplate-check
|
|
set +o pipefail
|
|
boilerplate-check check \
|
|
--boilerplate ./hack/boilerplate/boilerplate.${{ matrix.extension }}.txt \
|
|
--file-extension ${{ matrix.extension }} \
|
|
--exclude "(vendor|third_party)/" |
|
|
reviewdog -efm="%A%f:%l: %m" \
|
|
-efm="%C%.%#" \
|
|
-name="${{ matrix.language }} headers" \
|
|
-reporter="github-pr-check" \
|
|
-filter-mode="diff_context" \
|
|
-fail-on-error="true" \
|
|
-level="error"
|
|
echo '::endgroup::'
|