修复一些代码样式的问题 #1
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: Auto-Format | |
# This action works with pull requests and pushes on the main branch | |
on: | |
pull_request: | |
types: [closed] | |
branches: [master, PR-Branch] | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
actions: write | |
contents: write | |
pull-requests: write | |
jobs: | |
prettier: | |
name: Prettier | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
# Make sure the actual branch is checked out when running on pull requests | |
ref: PR-Branch | |
# This is important to fetch the changes to the previous commit | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Prettify code | |
uses: creyD/[email protected] | |
with: | |
# This part is also where you can pass other options, for example: | |
prettier_options: --write **/*.{js,ts,mjs,vue,json,yml,md} --config ./prettier.config.mjs --ignore-path ./.prettierignore | |
commit_message: "style: prettified code from pull request." | |
only_changed: True | |
github_token: ${{ secrets.FORMAT_TOKEN }} |