Skip to content

Format pull request

Format pull request #1

Workflow file for this run

name: Format pull request
on:
workflow_dispatch:
issue_comment:
types: [created]
jobs:
format:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' || (
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '!format')
)
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
# Credentials needed for pushing changes at the end
persist-credentials: true
- name: Install Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Format
run: npm run format
- name: Commit
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "[email protected]"
git stage .
git commit --author "format-pr-bot <[email protected]>" -m "[Automated] Format code" || echo "No changes to commit"
- name: Push
run: git push