summaryrefslogtreecommitdiff
path: root/.github/workflows/format.yaml
blob: e189f46216940d8314ac1bc3d44bec1209665e2f (plain)
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
38
39
40
41
name: format project

on:
  workflow_call:
  workflow_dispatch:

permissions:
  contents: write

jobs:
  cargo-fmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: setup nix & cachix
        uses: ./.github/actions/setup-nix
        with:
          cachix-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

      - name: run cargo fmt
        run: |
          nix build -L .#checks.x86_64-linux.fmt

  nix-fmt:
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    steps:
      - uses: actions/checkout@v3

      - name: setup nix & cachix
        uses: ./.github/actions/setup-nix
        with:
          cachix-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

      - run: nix fmt

      - uses: EndBug/add-and-commit@v9
        with:
          default_author: github_actions
          message: "chore: fmt nix files"