feat: Support using local directory as template (#162) #414
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: Linting | |
on: | |
push: | |
branches: | |
- main | |
- v* | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
changed-files: | |
name: Changed Files | |
runs-on: ubuntu-latest | |
outputs: | |
lint-go: ${{ steps.changed-files.outputs.lint-go_any_modified == 'true' }} | |
lint-npm: ${{ steps.changed-files.outputs.lint-npm_any_modified == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 # Assume PRs are less than 50 commits | |
- name: Find changed files | |
uses: tj-actions/changed-files@v45 | |
id: changed-files | |
with: | |
files_yaml: | | |
common: &common | |
- .github/workflows/linting.yml | |
- Makefile | |
lint-go: | |
- *common | |
- cmd/** | |
- go.* | |
- '*.go' | |
lint-npm: | |
- *common | |
- template/** | |
- '*.md' | |
- '*.yml' | |
- www/** | |
- .github/** | |
- package.json | |
- package-lock.json | |
go: | |
name: Linting Go | |
runs-on: ubuntu-latest | |
needs: changed-files | |
if: ${{ needs.changed-files.outputs.lint-go == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
~/.cache/golangci-lint | |
/go/pkg/mod | |
key: golint-${{ hashFiles('go.sum') }} | |
restore-keys: golint | |
- name: Lint | |
run: | | |
set -xe | |
make lint/go | |
npm: | |
name: Linting NPM | |
runs-on: ubuntu-latest | |
needs: changed-files | |
if: ${{ needs.changed-files.outputs.lint-npm == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: | | |
set -xe | |
npm i -g prettier | |
- name: Lint | |
run: | | |
set -xe | |
make lint/npm | |
check: | |
if: always() | |
name: Linting Successful | |
runs-on: ubuntu-latest | |
needs: [go, npm] | |
steps: | |
- name: Whether the whole test suite passed | |
uses: re-actors/[email protected] | |
with: | |
allowed-skips: ${{ toJSON(needs) }} | |
jobs: ${{ toJSON(needs) }} |