Skip to content

Merge pull request #1 from zero-to-mastery/main #153

Merge pull request #1 from zero-to-mastery/main

Merge pull request #1 from zero-to-mastery/main #153

name: Code Style fix
on:
pull_request_target:
branches:
- main
types:
- closed
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
codeStyle:
name: Fix Code Style
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true }} || ${{ github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: npm install
- name: Run Prettier
id: prettier-run
run: |
npm run prettier:fix
echo "filecount=$(git status -s -uno | wc -L)" >> $GITHUB_OUTPUT
- name: Commit changes
if: ${{ steps.prettier-run.outputs.filecount > 0 }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions - Prettier"
git add .
git commit -m "Run Prettier"
git push