Skip to content

Commit 6e0f5be

Browse files
committed
feat(github): add disko comparison workflow
1 parent 07ba78d commit 6e0f5be

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 'Compare Disko NixOS configs'
2+
3+
on:
4+
# Allow this workflow to be reused by other workflows:
5+
workflow_call:
6+
inputs:
7+
runner:
8+
description: 'JSON-encoded list of runner labels'
9+
default: '["self-hosted"]'
10+
required: false
11+
type: string
12+
secrets:
13+
CACHIX_AUTH_TOKEN:
14+
description: 'Cachix auth token'
15+
required: true
16+
17+
jobs:
18+
post-initial-comment:
19+
runs-on: ${{ fromJSON(inputs.runner) }}
20+
steps:
21+
- name: 'Post initial disko status comment'
22+
uses: marocchino/[email protected]
23+
with:
24+
recreate: true
25+
message: |
26+
Thanks for your Pull Request!
27+
28+
This comment will be updated automatically with the status of disko on each machine.
29+
compare-disko-configs:
30+
runs-on: ${{ fromJSON(inputs.runner) }}
31+
name: 'Compare disko configs on machines'
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Install Nix
37+
uses: metacraft-labs/nixos-modules/.github/install-nix@main
38+
with:
39+
cachix-cache: ${{ vars.CACHIX_CACHE }}
40+
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
41+
42+
- name: Compare disko configurations
43+
env:
44+
CACHIX_CACHE: ${{ vars.CACHIX_CACHE }}
45+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
46+
# MCL_BRANCH: ${{ github.repository == 'metacraft-labs/nixos-modules' && github.sha || 'main' }}
47+
MCL_BRANCH: ${{ github.repository == 'metacraft-labs/nixos-modules' && github.sha || 'feat/compare-disko' }}
48+
run: nix run --accept-flake-config github:metacraft-labs/nixos-modules/${{ env.MCL_BRANCH }}#mcl compare_disko
49+
50+
create-comment:
51+
runs-on: ${{ fromJSON(inputs.runner) }}
52+
name: 'Create comment'
53+
needs: [post-initial-comment, compare-disko-configs]
54+
55+
steps:
56+
- name: Post Comment
57+
uses: marocchino/[email protected]
58+
with:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
recreate: true
61+
path: comment.md

0 commit comments

Comments
 (0)