feat: github updater

This commit is contained in:
Philipp Hochkamp 2022-03-28 18:33:43 +02:00
parent 2c860c57aa
commit dcb627c4a4
No known key found for this signature in database
GPG key ID: 3676AB4CB36E5641
3 changed files with 52 additions and 75 deletions

52
.github/workflows/update.yaml vendored Normal file
View file

@ -0,0 +1,52 @@
# https://github.com/sandhose/nixconf/blob/master/.github/workflows/update.yaml
name: "Update lock file"
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: tibdex/github-app-token@v1.5
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: cachix/install-nix-action@v16
with:
install_url: https://releases.nixos.org/nix/nix-2.4/install
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup Git author
run: |
git config user.name 'GitHub Ations'
git config user.email 'noreply@github.com'
- name: Update lock file
run: nix flake update --no-registries --commit-lock-file
- name: Get commit message
id: commit
run: |
message="$(git log -1 --pretty=%B | tail +3 | awk -f ./misc/flake-to-markdown.awk)"
message="${message//'%'/'%25'}"
message="${message//$'\n'/'%0A'}"
message="${message//$'\r'/'%0D'}"
echo "::set-output name=message::$message"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.14.0
with:
token: "${{ steps.generate-token.outputs.token }}"
title: "Automated Flake update"
body: "${{ steps.commit.outputs.message }}"
delete-branch: truec