Nix Flake Updater #918
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nix Autoupdater | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
update-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v23 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
accept-flake-config = true | |
- name: Run the Magic Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@v2 | |
- run: | | |
nix shell nixpkgs#git -c git config user.name 'NixBot' | |
nix shell nixpkgs#git -c git config user.email '[email protected]' | |
## by building this we can rely on it not being affected by | |
## the flake being in some invalid state during updates | |
nix build .#world-updaters | |
./result/bin/update-github-release-flake-inputs ${{ secrets.GITHUB_TOKEN }} | |
nix flake update | |
./result/bin/update-all-cargo-vendor-shas | |
./result/bin/update-all-fixed-output-derivation-shas | |
nix shell nixpkgs#git -c git commit -am "[Auto] update all inputs" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
id: cpr | |
with: | |
token: ${{ secrets.MACHINE_USER_TOKEN }} | |
commit-message: '[Auto] Package updates' | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
branch: package-auto-updates | |
delete-branch: true | |
title: '[Auto] Package updates' | |
body: '' | |
labels: | | |
automated pr | |
assignees: johnae | |
reviewers: johnae | |
- name: Enable Pull Request Automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.MACHINE_USER_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: squash |