Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

update-nixpkgs

update-nixpkgs #4

name: update-nixpkgs
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
jobs:
niv-update:
runs-on: ubuntu-latest
steps:
- name: Get date
run: echo "BRANCH_NAME=nixpkgs-update-$(date +'%Y-%m-%dT%H%M%S')" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
- uses: cachix/cachix-action@v12
with:
name: rosuavio-personal
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-shell --run "niv update nixos-23.05"
- run: |
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git checkout -b $BRANCH_NAME
git commit -am "Update nixos-23.05"
git push -u origin $BRANCH_NAME
# Fallowing https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens
# I would like to not depend on anything here
# TODO: Figure this out myself
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
# If `github.token` is used then the PR wont trigger any other github actions
# Solutions:
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
- name: create pull request
run: |
PR=$(gh pr create -B main -H $BRANCH_NAME --title "Update nixos-23.05" --body "Update nixos-23.05")
gh pr merge $PR -d --rebase --auto
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}