ci: enable autofix for pr linting (#20085)

This commit is contained in:
Daniel Roe 2023-04-04 14:39:10 +01:00 committed by GitHub
parent b811742f89
commit feaebff823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 10 deletions

28
.github/workflows/autofix-docs.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: autofix.ci # needed to securely identify the workflow
on:
pull_request:
paths:
- "docs/**"
- ".github/workflows/docs.yml"
permissions:
contents: read
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Lint (docs)
run: pnpm lint:docs:fix

33
.github/workflows/autofix.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: autofix.ci # needed to securely identify the workflow
on:
pull_request:
paths-ignore:
- "docs/**"
permissions:
contents: read
jobs:
code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build (stub)
run: pnpm build:stub
- name: Lint (code)
run: pnpm lint:fix
- name: Test (unit)
run: pnpm test:unit -u

View File

@ -88,6 +88,8 @@ jobs:
run: pnpm test:types
lint:
# autofix workflow will be triggered instead for PRs
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 10
@ -169,9 +171,6 @@ jobs:
- name: Test (unit)
run: pnpm test:unit
env:
TEST_ENV: ${{ matrix.env }}
TEST_BUILDER: ${{ matrix.builder }}
- name: Test (fixtures)
run: pnpm test:fixtures

View File

@ -5,14 +5,13 @@ on:
paths:
- "docs/**"
- ".github/workflows/docs.yml"
# autofix workflow will be triggered instead for PRs
branches:
- main
pull_request:
paths:
- "docs/**"
- ".github/workflows/docs.yml"
branches:
- main
# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}
jobs:
lint-docs:

View File

@ -1,4 +1,4 @@
name: Docs
name: CI
on:
push:

View File

@ -12,6 +12,7 @@
"example": "./scripts/example.sh dev",
"example:build": "./scripts/example.sh build",
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
"lint:fix": "eslint --ext .vue,.ts,.js,.mjs . --fix",
"lint:docs": "markdownlint ./docs && case-police 'docs/**/*.md'",
"lint:docs:fix": "markdownlint ./docs --fix && case-police 'docs/**/*.md' --fix",
"nuxi": "JITI_ESM_RESOLVE=1 nuxi",