ci: add eslint (#7) #20
This file contains hidden or 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: Code Health | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
with: | |
config: ${{ vars.PERMISSIONS_CONFIG }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: package.json | |
cache: "npm" | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: build | |
run: | | |
npm run build | |
- name: Check for uncommitted files | |
run: | | |
export FILES= | |
FILES=$(git ls-files -o -m --directory --exclude-standard --no-empty-directory) | |
export LINES= | |
LINES=$(echo "$FILES" | awk 'NF' | wc -l) | |
if [ "$LINES" -ne 0 ]; then | |
echo "Detected files that need to be committed:" | |
echo "${FILES}" | |
echo "" | |
echo "Try running: npm run build" | |
exit 1 | |
fi | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
with: | |
config: ${{ vars.PERMISSIONS_CONFIG }} | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: package.json | |
cache: "npm" | |
- name: Install dependencies | |
run: | | |
npm ci | |
- run: | | |
npm run check:format | |
eslint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
with: | |
config: ${{ vars.PERMISSIONS_CONFIG }} | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: package.json | |
cache: "npm" | |
- name: Install dependencies | |
run: | | |
npm ci | |
- run: | | |
npm run check:lint |