Skip to content

Commit c0d77da

Browse files
committed
add flake.lock updating and building before commiting
1 parent af9b31c commit c0d77da

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Update flake.lock
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 6 */3 * *"
6+
jobs:
7+
update-flake-lock:
8+
name: Update flake.lock
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
- name: Install Nix
16+
uses: cachix/install-nix-action@v31
17+
with:
18+
nix_path: nixpkgs=channel:nixpkgs-unstable
19+
- name: Update flake.lock
20+
run: |
21+
nix flake update
22+
- name: Check if update is needed
23+
id: check
24+
run: |
25+
if git diff --quiet -- flake.lock; then
26+
echo "should_update=false" >>"$GITHUB_OUTPUT"
27+
else
28+
echo "should_update=true" >>"$GITHUB_OUTPUT"
29+
fi
30+
- name: Validate builds
31+
if: steps.check.outputs.should_update == 'true'
32+
run: |
33+
nix build .#t3code .#t3code-appimage .#t3code-with-codex .#t3code-appimage-with-codex
34+
- name: Commit changes
35+
if: steps.check.outputs.should_update == 'true'
36+
uses: stefanzweifel/git-auto-commit-action@v6
37+
with:
38+
commit_message: "update: flake.lock"
39+
file_pattern: "flake.lock"

.github/workflows/t3code-update.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ jobs:
3030
GH_TOKEN: ${{ github.token }}
3131
run: |
3232
bash .github/update.sh --ci
33+
- name: Validate builds
34+
if: steps.check.outputs.should_update == 'true'
35+
run: |
36+
nix build .#t3code .#t3code-appimage .#t3code-with-codex .#t3code-appimage-with-codex
3337
- name: Commit changes
3438
id: commit
3539
if: steps.check.outputs.should_update == 'true'
3640
uses: stefanzweifel/git-auto-commit-action@v6
3741
with:
3842
commit_message: "${{ steps.update.outputs.commit_message }}"
39-
file_pattern: "*"
43+
file_pattern: "sources.json"

0 commit comments

Comments
 (0)