Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Create main.yml

Create main.yml #1

Workflow file for this run

name: Format Code with Prettier
on:
push:
branches:
- main # Adjust this to your main branch name
pull_request:
branches:
- main # Adjust this to your main branch name
jobs:
format:
name: Format Code
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set Up Node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: Format Code with Prettier
run: npx prettier --write "**/*.{js,jsx,ts,tsx,json,css,scss,md}"
- name: Commit and Push Changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git diff-index --quiet HEAD || git commit -m "Auto-format code with Prettier [skip ci]"
git push