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

70 lines
2.5 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: |
2022-05-18 07:20:39 +00:00
substituters = https://cache.nixos.org/ https://f000.backblazeb2.com/file/cache-chir-rs/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 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
2022-05-16 07:37:39 +00:00
nix show-derivation -r ".#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
2022-05-16 07:37:39 +00:00
nix show-derivation -r ".#hydraJobs.$job.x86_64-linux" > new-$job.json
2022-05-15 20:31:22 +00:00
2022-05-15 20:39:47 +00:00
python scripts/diff-drvs.py old-$job.json new-$job.json > report-$job.txt
2022-05-15 20:31:22 +00:00
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
2022-05-16 09:09:10 +00:00
echo '```' >> pr-message.txt
2022-05-15 20:31:22 +00:00
cat report-$job.txt >> pr-message.txt
2022-05-16 09:09:10 +00:00
echo '```' >> pr-message.txt
2022-05-15 20:31:22 +00:00
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
if: steps.update-step.outputs.body != ''
2022-05-15 20:31:22 +00:00
with:
2022-05-17 14:16:18 +00:00
token: ${{ secrets.GITHUB_TOKEN }}
2022-05-15 20:31:22 +00:00
body: ${{ steps.update-step.outputs.body }}
commit-message: Update flake.lock
committer: GitHub <noreply@github.com>
2022-05-16 09:09:10 +00:00
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-05-15 20:31:22 +00:00
branch: update-flake
delete-branch: true
title: "Update flake.nix"
labels: |
update
automated
assignees: darkkirb
reviewers: darkkirb
add-paths: flake.lock