mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
name: lint-format
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: lint-format-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check-and-fix:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Run checks
|
|
id: check
|
|
continue-on-error: true
|
|
run: |
|
|
bun run lint
|
|
bun run format:check
|
|
bun run lint:md
|
|
|
|
- name: Apply fixes
|
|
run: |
|
|
bunx eslint src/ --fix
|
|
bunx prettier --write .
|
|
bunx markdownlint "**/*.md" --ignore node_modules --ignore dist --fix
|
|
|
|
- name: Commit and push fixes
|
|
if: steps.check.outcome == 'failure'
|
|
run: |
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
echo "No changes to commit"
|
|
exit 0
|
|
fi
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git config commit.gpgsign false
|
|
git add -A
|
|
git commit -m "chore: auto-fix lint & formatting [skip ci]"
|
|
git push
|
|
|
|
- name: Verify fixes
|
|
run: |
|
|
bun run lint
|
|
bun run format:check
|
|
bun run lint:md
|