Skip to content

Modified prettier.yml file #16

Modified prettier.yml file

Modified prettier.yml file #16

Workflow file for this run

name: Format Code
on:
push:
branches:
- "**"
jobs:
format:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Format code with Prettier
run: yarn format
- name: Check for changes
id: git_changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git status --porcelain > changes.txt
echo "Changes detected:"
cat changes.txt
if [[ -s changes.txt ]]; then
echo "##[set-output name=changes_detected;]true"
else
echo "##[set-output name=changes_detected;]false"
fi
- name: Commit and push changes
if: steps.git_changes.outputs.changes_detected == 'true'
run: |
git add .
git commit -m "Format code with Prettier"
git push