summaryrefslogtreecommitdiff
path: root/.github/workflows/checkandformat.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/checkandformat.yml')
-rw-r--r--.github/workflows/checkandformat.yml37
1 files changed, 37 insertions, 0 deletions
diff --git a/.github/workflows/checkandformat.yml b/.github/workflows/checkandformat.yml
new file mode 100644
index 0000000..2856163
--- /dev/null
+++ b/.github/workflows/checkandformat.yml
@@ -0,0 +1,37 @@
+name: check and format flake
+
+on:
+ pull_request:
+ push:
+ workflow_dispatch:
+
+jobs:
+ check:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: cachix/install-nix-action@v19
+ with:
+ github_access_token: ${{ secrets.GITHUB_TOKEN }}
+
+ - run: nix flake check
+ format:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ if: ${{ github.event_name == 'pull_request' }}
+ with:
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ ref: ${{ github.event.pull_request.head.ref }}
+
+ - uses: cachix/install-nix-action@v19
+ with:
+ github_access_token: ${{ secrets.GITHUB_TOKEN }}
+
+ - run: nix fmt
+
+ - uses: EndBug/add-and-commit@v9
+ with:
+ default_autor: github_actions
+ message: "chore: format flake"