Skip to content

Commit

Permalink
update Prettier workflow to trigger on pull requests for develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit3523 committed Jan 10, 2025
1 parent dd955f1 commit b4f00c7
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Format Code with Prettier

on:
push:
pull_request:
branches:
- '*'
- '!develop'
- '!master'
- '!single-server'
- 'develop'

jobs:
format:
Expand All @@ -19,8 +16,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Set up Node.js
Expand All @@ -36,7 +31,6 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install dependencies
run: yarn install

Expand All @@ -53,12 +47,11 @@ jobs:
echo "Code format changes detected"
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add .
git commit -m "chore: format code with Prettier"
git push origin HEAD:${{ github.head_ref || github.ref_name }}
git push origin HEAD:${{ github.head_ref }}

0 comments on commit b4f00c7

Please sign in to comment.