Skip to content

feat: add solutions to lc problem: No.3397 #4047

feat: add solutions to lc problem: No.3397

feat: add solutions to lc problem: No.3397 #4047

Workflow file for this run

name: prettier
on:
pull_request_target:
types: [opened, edited, reopened, synchronize]
concurrency:
group: ${{github.workflow}} - ${{github.ref}}
cancel-in-progress: true
jobs:
format:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Dependencies
run: npm install
- name: Run prettier
run: |
git config --global core.quotepath off
changed_files=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" | grep -E '\.js$|\.ts$|\.php$|\.sql$|\.md$' || true)
if [ -n "$changed_files" ]; then
echo "Running prettier on the changed files"
echo "$changed_files" | xargs -d '\n' npx prettier --write
else
echo "No matching files to run prettier on."
fi
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: format code and docs with prettier"
commit_user_name: idoocs
commit_user_email: [email protected]