Skip to content

Auto-update nix flake inputs #1148

Auto-update nix flake inputs

Auto-update nix flake inputs #1148

---
name: Auto-update nix flake inputs
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * *" # runs every day at 08:00 UTC
jobs:
enumerate-flake-inputs:
name: Update flake inputs
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-inputs.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/nix-installer-action@main
- id: get-inputs
name: Get flake inputs
run: |
inputs=$(nix flake metadata --json | jq --raw-output '.locks.nodes.root.inputs | keys[]' | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')
echo "matrix=$inputs" >> "$GITHUB_OUTPUT"
update-flake-inputs:
needs: enumerate-flake-inputs
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
flake-input: ${{ fromJson(needs.enumerate-flake-inputs.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/nix-installer-action@main
- name: Update ${{ matrix.flake-input }} flake input
uses: DeterminateSystems/update-flake-lock@v28
with:
branch: update-flake-input-${{ matrix.flake-input }}
commit-msg: "chore(nix): update ${{ matrix.flake-input }} flake input"
inputs: ${{ matrix.flake-input }}
git-author-name: github-actions
git-author-email: action@github.com
git-committer-name: github-actions
git-committer-email: action@github.com
pr-assignees: EricCrosson
pr-title: Update ${{ matrix.flake-input }} flake input
pr-labels: |
dependencies
nix
${{ matrix.flake-input }}
token: ${{ secrets.GH_TOKEN_PR }}
enumerate-dev-shell-inputs:
name: Update nix/flake.nix inputs
needs: update-flake-inputs
runs-on: ubuntu-latest
# Run only once per week on Monday at 08:00 UTC
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1')
outputs:
matrix: ${{ steps.get-inputs.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/nix-installer-action@main
- id: get-inputs
name: Get nix/flake.nix inputs
run: |
inputs=$(nix flake metadata --json nix/ | jq --raw-output '.locks.nodes.root.inputs | keys[]' | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')
echo "matrix=$inputs" >> "$GITHUB_OUTPUT"
update-nix-flake-inputs:
needs: enumerate-dev-shell-inputs
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
flake-input: ${{ fromJson(needs.enumerate-dev-shell-inputs.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/nix-installer-action@main
- name: Update ${{ matrix.flake-input }} in nix/flake.nix
uses: DeterminateSystems/update-flake-lock@v28
with:
path-to-flake-dir: nix
branch: update-nix-flake-input-${{ matrix.flake-input }}
commit-msg: "chore(nix): update ${{ matrix.flake-input }} in nix/flake.nix"
inputs: ${{ matrix.flake-input }}
git-author-name: github-actions
git-author-email: action@github.com
git-committer-name: github-actions
git-committer-email: action@github.com
pr-assignees: EricCrosson
pr-title: Update ${{ matrix.flake-input }} in nix/flake.nix
pr-labels: |
dependencies
nix
${{ matrix.flake-input }}
token: ${{ secrets.GH_TOKEN_PR }}