Skip to content

Add workflow for automatically formatting on PR #2

Add workflow for automatically formatting on PR

Add workflow for automatically formatting on PR #2

Workflow file for this run

name: Format code
on:
pull_request:
branches:
- main
jobs:
format:
name: Format code
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- run: npx prettier --write .
- name: Push changes
run: |
if [ -n "$(git status --porcelain)" ]; then
# github-actions name and email derived from https://github.com/orgs/community/discussions/26560
git commit -am "Automatic formatting" \
--author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
git push
fi