summaryrefslogtreecommitdiff
path: root/.github/workflows/update-lock.yaml
diff options
context:
space:
mode:
authorseth <[email protected]>2024-01-26 05:43:47 -0500
committerseth <[email protected]>2024-01-26 05:43:47 -0500
commit90c83b4694150bdcfe4fcac1c55fcfdef17c3612 (patch)
tree74f3a8d9cac0b972fc7e50fdcf2403f60e39795e /.github/workflows/update-lock.yaml
initial commit
Diffstat (limited to '.github/workflows/update-lock.yaml')
-rw-r--r--.github/workflows/update-lock.yaml60
1 files changed, 60 insertions, 0 deletions
diff --git a/.github/workflows/update-lock.yaml b/.github/workflows/update-lock.yaml
new file mode 100644
index 0000000..9a3628f
--- /dev/null
+++ b/.github/workflows/update-lock.yaml
@@ -0,0 +1,60 @@
+name: Update flake.lock
+
+on:
+ schedule:
+ # run every saturday
+ - cron: "0 0 * * 6"
+ workflow_dispatch:
+
+jobs:
+ update:
+ name: Update
+ runs-on: ubuntu-latest
+ container: nixos/nix:sha256:b8ea88f763f33dfda2317b55eeda3b1a4006692ee29e60ee54ccf6d07348c598 # 2.19.3
+
+ permissions:
+ contents: write
+ pull-requests: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+
+ - name: Create new branch
+ id: branch
+ run: |
+ branch="update-flake-lock"
+
+ echo "branch=$branch" >> "$GITHUB_OUTPUT"
+ git switch -c "$branch"
+
+ - name: Update flake inputs
+ run: |
+ nix flake update \
+ --commit-lock-file \
+ --commit-lockfile-summary "chore: update flake inputs"
+
+ - name: Update test flake inputs
+ run: |
+ pushd ./dev
+
+ nix flake update \
+ --commit-lock-file \
+ --commit-lockfile-summary "chore: update test flake inputs"
+
+ popd
+
+ - name: Make PR if needed
+ env:
+ GH_TOKEN: ${{ github.token }}
+ BRANCH: ${{ steps.branch.outputs.branch }}
+ run: |
+ if ! git diff --color=always --exit-code origin/main; then
+ git push -u origin "$BRANCH"
+
+ gh pr create \
+ --base main \
+ --head "$BRANCH" \
+ --title "chore: update flake inputs" \
+ --fill
+ fi