Skip to content

Commit

Permalink
ci: format nix file changes on push
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed May 21, 2024
1 parent 1f11b0a commit 97d41ba
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,51 @@ on:

jobs:
format:
name: Check formatting
name: Format Nix files

if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Get short revision
id: rev
run:
echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"

- name: Install Nix
uses: cachix/install-nix-action@V27
uses: cachix/install-nix-action@v27

- name: Run formatter
- name: Format changes
run: |
nix run --inputs-from ./dev nixpkgs#nixpkgs-fmt -- .
nix run \
--inputs-from ./dev \
'nixpkgs#nixfmt-rfc-style' -- .
- name: Check for changes
run: git diff --color=always --exit-code
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
uses: planetscale/[email protected]
with:
commit_message: "style: format ${{ steps.rev.outputs.rev }}"
repo: "${{ github.repository }}"
branch: "${{ github.head_ref || github.ref_name }}"

vm:
name: Test Modules

runs-on: ubuntu-latest

strategy:
matrix:
test: [unstable, stable]

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@V27
Expand Down

0 comments on commit 97d41ba

Please sign in to comment.