summaryrefslogtreecommitdiff
path: root/.github/workflows/format.yml
blob: 06bc83311ace95f0a82cce404e7298f35a57282f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: "Format Code"

on:
  push:
    branches:
      - main

jobs:
  format:
    runs-on: ubuntu-latest
    env:
      NODE_OPTIONS: "--max_old_space_size=4096"
    steps:
      - name: Check out code using Git
        uses: actions/checkout@v3
        with:
          ref: ${{ github.head_ref }}
          # Needs access to push to main
          token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
      - name: Setup PNPM
        uses: pnpm/action-setup@v2
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: "pnpm"
      - name: Install dependencies
        run: pnpm install
      - name: Format code
        run: pnpm run format:ci
      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: "[ci] format"
          branch: ${{ github.head_ref }}
          commit_user_name: fredkbot
          commit_user_email: fred+astrobot@astro.build