Skip to content

Commit 636a1b1

Browse files
committed
add workflow
1 parent 06a0ccb commit 636a1b1

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/flake-update.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Flake.lock: update Nix dependencies"
2+
on:
3+
workflow_dispatch: # allows manual triggering
4+
schedule:
5+
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
6+
jobs:
7+
nix-flake-update:
8+
permissions:
9+
contents: write
10+
id-token: write
11+
issues: write
12+
pull-requests: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
token: ${{ secrets.GHA_PAT_TOKEN }}
18+
- uses: cachix/install-nix-action@v31
19+
- uses: cachix/cachix-action@v16
20+
with:
21+
name: kalbasit
22+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
23+
- name: update flake.lock and run go mod tidy
24+
id: update-flake-lock-and-go-mod-tidy
25+
run: |
26+
nix flake update
27+
nix develop --command go mod tidy
28+
- uses: EndBug/add-and-commit@v9
29+
if: ${{ steps.update-flake-lock-and-go-mod-tidy.outcome == 'success' }}
30+
id: commit
31+
with:
32+
default_author: github_actions
33+
message: "chore: update flake.lock and run go mod tidy"
34+
fetch: false
35+
new_branch: "update-flake-lock"
36+
push: --set-upstream origin "update-flake-lock" --force
37+
- uses: thomaseizinger/create-pull-request@1.4.0
38+
if: ${{ steps.commit.outputs.pushed == 'true' }}
39+
id: create_pr
40+
with:
41+
github_token: ${{ secrets.GHA_PAT_TOKEN }}
42+
head: "update-flake-lock"
43+
base: main
44+
title: "chore: update flake.lock and run go mod tidy"
45+
- name: enable automerge
46+
if: ${{ steps.create_pr.outputs.created }}
47+
run: gh pr merge --squash --auto "${{ steps.create_pr.outputs.number }}"
48+
env:
49+
GH_TOKEN: "${{ secrets.GHA_PAT_TOKEN }}"

0 commit comments

Comments
 (0)