nixos-config/.github/workflows/update.yml

68 lines
2.4 KiB
YAML
Raw Normal View History

2022-04-15 18:25:17 +00:00
name: Update flake
on:
schedule:
2022-05-15 20:31:22 +00:00
- cron: "35 4 * * *"
2022-04-15 18:43:00 +00:00
workflow_dispatch: {}
2022-04-15 18:25:17 +00:00
jobs:
update-flake:
name: Update flake
runs-on: ubuntu-latest
steps:
2022-04-15 19:56:22 +00:00
- uses: actions/checkout@v3
2022-04-15 18:48:55 +00:00
with:
token: ${{ secrets.PUBLISH_TOKEN }}
2022-04-16 16:55:02 +00:00
- uses: cachix/install-nix-action@v17
with:
extra_nix_config: |
substituters = https://f000.backblazeb2.com/file/cache-chir-rs/ https://cache.nixos.org/
trusted-public-keys = nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=
2022-05-15 20:31:22 +00:00
# instantiate the current derivations
- id: update-step
run: |
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac installer nas; do
nix show-derivation ".#hydraJobs.$job.x86_64-linux" > old-$job.json
2022-05-15 20:31:22 +00:00
done
nix flake update
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac installer nas; do
nix show-derivation ".#hydraJobs.$job.x86_64-linux" > new-$job.json
2022-05-15 20:31:22 +00:00
python scripts/diff-drvs old-$job.json new-$job.json > report-$job.txt
cat report-$job.txt >> full-report.txt
done
if [ -s full-report.txt ]; then
echo "Automatic flake.lock update" > pr-message.txt
echo "" >> pr-message.txt
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac installer nas; do
echo "## Changes for $job:" >> pr-message.txt
echo "```" >> pr-message.txt
cat report-$job.txt >> pr-message.txt
echo "```" >> pr-message.txt
done
else
touch pr-message.txt
fi
body=$(cat pr-message.txt)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PUBLISH_TOKEN }}
body: ${{ steps.update-step.outputs.body }}
commit-message: Update flake.lock
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: update-flake
delete-branch: true
title: "Update flake.nix"
labels: |
update
automated
assignees: darkkirb
reviewers: darkkirb