File tree Expand file tree Collapse file tree 6 files changed +497
-333
lines changed Expand file tree Collapse file tree 6 files changed +497
-333
lines changed Original file line number Diff line number Diff line change 1+ name : Update Crush Settings
2+
3+ on :
4+ schedule :
5+ # Run daily at 3:00 UTC
6+ - cron : " 0 3 * * *"
7+ workflow_dispatch : # Allow manual triggering
8+
9+ jobs :
10+ update-schema :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v5
15+
16+ - name : Install nix
17+ uses : cachix/install-nix-action@v31
18+ with :
19+ extra_nix_config : |
20+ experimental-features = nix-command flakes
21+ access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
22+
23+ - name : Setup Go
24+ uses : actions/setup-go@v5
25+ with :
26+ go-version : " 1.21"
27+
28+ - name : Generate options from schema
29+ run : |
30+ cd scripts && go generate
31+
32+ - name : Format with alejandra
33+ run : |
34+ nix-shell -p alejandra --run "alejandra modules/crush/options/settings.nix"
35+
36+ - name : Check for changes
37+ id : check_changes
38+ run : |
39+ if git diff --quiet modules/crush/options.nix; then
40+ echo "changed=false" >> $GITHUB_OUTPUT
41+ else
42+ echo "changed=true" >> $GITHUB_OUTPUT
43+ fi
44+
45+ - name : Open pull request
46+ if : steps.check_changes.outputs.changed == 'true'
47+ uses : peter-evans/create-pull-request@v7
48+ with :
49+ commit-message : " chore: update crush schema options"
50+ title : " Update Crush schema options"
51+ body : |
52+ This PR updates the Crush module options from the latest schema.
53+
54+ Generated automatically by the daily schema update workflow.
55+ branch : " update-crush-schema"
56+ base : " master"
57+ delete-branch : true
Original file line number Diff line number Diff line change 1+ # Scripts
2+
3+ ## Crush module options generator
4+
5+ Generates Nix module options from the Crush JSON schema.
6+
7+ ### Usage
8+
9+ ``` bash
10+ cd scripts && go generate
11+ ```
12+
13+ The generator automatically fetches the version from ` pkgs/crush/default.nix ` and downloads the corresponding schema from GitHub.
14+
15+ You can also run it manually:
16+
17+ ``` bash
18+ go run scripts/generate-crush-settings.go -output modules/crush/options/settings.nix
19+ ```
20+
21+ ### Automatic updates
22+
23+ A GitHub Actions workflow runs daily at 3:00 UTC to check for schema updates and automatically opens a PR if changes are detected.
Original file line number Diff line number Diff line change 1+ // Package main generates Nix module options from Crush schema.
2+ //
3+ //go:generate sh -c "cd .. && go run scripts/generate-crush-settings.go -output modules/crush/options/settings.nix"
4+ package main
You can’t perform that action at this time.
0 commit comments