This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
npins-update #5
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: npins-update | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
npins-update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get date | |
run: echo "BRANCH_NAME=npins-update-$(date +'%Y-%m-%dT%H%M%S')" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v23 | |
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 "npins update" | |
- run: | | |
git --version | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git checkout -b $BRANCH_NAME | |
git commit -am "npins update" | |
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@v2 | |
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 "npins update" --body "Update nix dependencies with npins") | |
gh pr merge $PR -d --rebase --auto | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} |