on:
issue_comment:
types: [created]
jobs:
prettier:
runs-on: ubuntu-latest
name: Run Prettier
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# see https://github.com/stefanzweifel/git-auto-commit-action#commits-of-this-action-do-not-trigger-new-workflow-runs
token: ${{ secrets.PRIVATE_ACCESS_TOKEN }}
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: 'npm'
- run: npm ci
- name: run prettier command
uses: ykpythemind/run_prettier_action@v1
with:
prettier_command: ./node_modules/.bin/prettier --write
GITHUB_TOKEN: ${{ secrets.PRIVATE_ACCESS_TOKEN }}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply prettier changes
skip_fetch: true
インストールすると、PRコメントで /prettier
を入力することで自動でprettierをかけ、commitを積んでくれるactionが起動します。
pre commit hookが苦手な方、任意のタイミングでprettierかけたい方にオススメです
Your repository must contain prettier
package on package.json
npm run ncc
Go to https://github.com/ykpythemind/run_prettier_action/actions/workflows/integration.yml and dispatch workflow.