Skip to content

feat: 库街区在线登录 ( #10 ) #81

feat: 库街区在线登录 ( #10 )

feat: 库街区在线登录 ( #10 ) #81

Workflow file for this run

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 }}