Skip to content

Commit

Permalink
Add formatting workflow (#1770)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Weber <[email protected]>
  • Loading branch information
CubesterYT and GarboMuffin authored Dec 26, 2024
1 parent 73ef778 commit 32de315
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/format-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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

0 comments on commit 32de315

Please sign in to comment.