Skip to content

使用Action保证代码格式 #277

使用Action保证代码格式

使用Action保证代码格式 #277

Workflow file for this run

name: GitHub Pages for PR
on: [pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Checkout To Pull Request
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- name: 📦 Install Dependencies
run: yarn
- name: 🧐 Check Code
run: yarn docs:tsc
- name: 🌌 Build VitePress Docs
run: yarn docs:build
- name: 🔧 Format Code
run: yarn docs:format
- name: Push Formatted Code
run: |
git config user.name github-actions
git config user.email github-actions[bot]@users.noreply.github.com
git config push.default upstream
git add .
git commit -m "🔧 Formatted Code" || exit 0
git push || echo "Warn: cannot push the formatted code"