Skip to content

Formatting

Formatting #42

Workflow file for this run

name: Formatting
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
permissions: read-all
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Run Prettier
run: npx prettier --write .
- name: Check for modified files
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "[Bot]: Auto Formatting"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}