Skip to content

Commit 60ec9e4

Browse files
committed
Adapt github action to just auto format everything
The previous version just checked if the files were formatted, but this is unnecessary, since I can just make it format everything no matter what so I do not need to deal with formatting manually.
1 parent 0ceeb64 commit 60ec9e4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/nix-ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- '**/*.nix'
1010
workflow_dispatch:
1111

12+
permissions:
13+
contents: write
14+
1215
jobs:
1316
check:
1417
runs-on: ubuntu-latest
@@ -31,11 +34,21 @@ jobs:
3134
steps:
3235
- name: Checkout repository
3336
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
3439

3540
- name: Set up Nix
3641
uses: cachix/install-nix-action@v22
3742
with:
3843
nix_path: nixpkgs=channel:nixos-unstable
3944

40-
- name: Install nixfmt
41-
run: nix-shell -p nixfmt-rfc-style --command "find . -name '*.nix' -print0 | xargs -0 nixfmt --check"
45+
- name: Install nixfmt and format .nix files
46+
run: nix-shell -p nixfmt-rfc-style --command "find . -name '*.nix' -print0 | xargs -0 nixfmt"
47+
48+
- name: Commit and push formatted files
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
52+
git add .
53+
git diff --cached --quiet || git commit -m "Auto-format Nix files"
54+
git push

users/lukas.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
tree
2222
unzip
2323
usbutils
24+
vimv
2425
wget
2526
yazi
2627
zoxide

0 commit comments

Comments
 (0)