Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/update-flake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Update flake.lock

on:
schedule:
# run every saturday
- cron: "0 0 * * 6"
workflow_dispatch:

jobs:
update:
name: Run update

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

env:
PR_BRANCH: "update-lockfiles"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v26

- name: Set Git user info
run: |
git config user.name 'IogaMaster'
git config user.email 'iogamastercode@gmail.com'

- name: Create new branch
id: branch
run: |
git switch -c "$PR_BRANCH"

- name: Update flake inputs
run: |
nix flake update \
--commit-lock-file \
--commit-lockfile-summary "$(printf "build(flake): update flake.lock\n\nCo-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>")"

- name: Make PR if needed
env:
GH_TOKEN: ${{ github.token }}
run: |
if ! git diff --color=always --exit-code origin/main; then
git fetch origin "$PR_BRANCH" || true
git push --force-with-lease -u origin "$PR_BRANCH"

open_prs="$(gh pr list --base main --head "$PR_BRANCH" | wc -l)"
if [ "$open_prs" -eq 0 ]; then
gh pr create \
--base main \
--head "$PR_BRANCH" \
--title "build(flake): update flake.lock" \
--fill
fi
fi
118 changes: 56 additions & 62 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.