-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.62 KB
/
Copy pathcheck-nix-updates.yml
File metadata and controls
88 lines (76 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Check Nix Updates
on:
schedule:
# Run every Monday at 09:00 UTC
- cron: '0 9 * * 1'
workflow_dispatch:
push:
branches: [master]
paths:
- 'flake.lock'
- '.github/workflows/check-nix-updates.yml'
pull_request:
paths:
- 'flake.lock'
- 'flake.nix'
- '.github/workflows/check-nix-updates.yml'
jobs:
check-flake:
name: Check Flake Health
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Check flake
uses: DeterminateSystems/flake-checker-action@v9
with:
fail-mode: false # Don't fail the workflow, just report
send-statistics: false # Don't send telemetry
check-updates:
name: Check for Updates
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v22
- name: Check for updates manually
run: |
echo "🔍 Checking for Nix flake updates..."
# Configure git to use the GitHub token for authentication
git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
# Save current lock file
cp flake.lock flake.lock.original
# Try updating
nix flake update --accept-flake-config || {
echo "⚠️ Could not check for updates (this may happen with private repos or rate limits)"
echo "To check manually, run: nix flake update"
mv flake.lock.original flake.lock
exit 0
}
# Check if anything changed
if ! cmp -s flake.lock flake.lock.original; then
echo "📦 Updates are available!"
echo ""
echo "To see what changed, run:"
echo '```bash'
echo 'git diff flake.lock'
echo '```'
echo ""
echo "### How to update:"
echo '```bash'
echo 'nix flake update'
echo 'git add flake.lock'
echo 'git commit -m "chore: update Nix flake dependencies"'
echo '```'
# Restore original to avoid committing changes
mv flake.lock.original flake.lock
else
echo "✅ All Nix flake inputs are up to date!"
rm flake.lock.original
fi
- name: Test current flake
run: |
echo "🧪 Testing current flake configuration..."
nix flake check
echo "✅ Flake check passed"