docs: 更新日志 #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint & Format Code | |
on: | |
workflow_dispatch: ~ | |
push: | |
paths: | |
- "**/*.js" | |
branches: | |
- "master" | |
- "dev" | |
jobs: | |
Format-Code: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: npm install | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Format code | |
run: npx prettier --write "**/*.js" | |
- run: git config --global user.name "github-actions" | |
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- run: git checkout -- package-lock.json | |
- run: git stash | |
- run: git checkout ${{ steps.extract_branch.outputs.branch }} && git pull | |
- run: git stash pop || true | |
- name: Commit code changes | |
run: "git add -u && git commit -m 'style: format code [skip ci]' || true" | |
- name: Push code changes | |
run: git push --set-upstream --force origin ${{ steps.extract_branch.outputs.branch }} |