Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@ name: autofix.ci
on:
pull_request:
push:
permissions: {}

permissions:
contents: write

jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # important so git diff works

- uses: actions/setup-node@v4
- run: |
yarn
yarn prettier . --write

- name: Install deps
run: yarn

- name: Run prettier on changed files
run: |
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \
| grep -E '\.(ts|tsx|js|jsx|json|md|yaml|yml|css|scss)$' || true)

if [ -n "$CHANGED_FILES" ]; then
echo "$CHANGED_FILES" | xargs yarn prettier --write
else
echo "No files to format"
fi

- uses: autofix-ci/action@v1
with:
commit-message: "Apply Prettier format"
commit-message: "Apply Prettier format"
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/**
Loading