Skip to content

update flakes

update flakes #37080

name: update flakes
on:
schedule:
- cron: '*/30 * * * *'
workflow_dispatch:
jobs:
update-flakes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v25
with:
nix_path: 'nixpkgs=channel:nixos-unstable'
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes recursive-nix
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v14
with:
name: dendrite-demo-pinecone
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: git config --global user.email "noreply@github.com"
- run: git config --global user.name "GitHub"
- run: echo "before_rev=$(nix flake metadata --json | jq '.locks.nodes.dendrite.locked.rev')" >> "$GITHUB_ENV"
- name: Update flakes
run: nix flake update --commit-lock-file
- run: echo "after_rev=$(nix flake metadata --json | jq '.locks.nodes.dendrite.locked.rev')" >> "$GITHUB_ENV"
- name: Update vendorSha256
if: ${{ env.before_rev != env.after_rev }}
run: ./update.sh
- name: git commit (amend)
run: |
git status --porcelain
if git status --porcelain | grep -q '^.M'; then
echo run git commit
git add .
git commit --amend --no-edit
echo "need_pr=1" >> "$GITHUB_ENV"
else
echo no changes
fi
- name: Create Pull Request
if: ${{ env.need_pr == 1 }}
uses: peter-evans/create-pull-request@v6
with:
branch: flake-update
commit-message: "flake: update"
delete-branch: true
title: "flake: update"
token: ${{ secrets.PAT }}
- name: Enable Pull Request Automerge
if: ${{ env.need_pr == 1 }}
run: gh pr merge --rebase --auto --delete-branch "flake-update"
env:
GH_TOKEN: ${{ secrets.PAT }}