70 lines
2.9 KiB
YAML
70 lines
2.9 KiB
YAML
name: Update flake
|
|
on:
|
|
schedule:
|
|
- cron: "35 4 * * *"
|
|
workflow_dispatch: {}
|
|
jobs:
|
|
update-flake:
|
|
name: Update flake
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
token: ${{ secrets.PUBLISH_TOKEN }}
|
|
- uses: cachix/install-nix-action@v17
|
|
with:
|
|
extra_nix_config: |
|
|
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=
|
|
# instantiate the current derivations
|
|
- id: update-step
|
|
run: |
|
|
nix flake update
|
|
echo "Difference between this PR and main:" > report
|
|
echo "" >> report
|
|
for job in nixos-8gb-fsn1-1 nutty-noon thinkrac nas; do
|
|
old_job=$(nix build --dry-run "github:DarkKirb/nixos-config/main#hydraJobs.$job.x86_64-linux" 2>&1 | grep nixos-system-$job | grep drv | tail -n1 | sed 's/ //g')
|
|
new_job=$(nix build --dry-run ".#hydraJobs.$job.x86_64-linux" 2>&1 | grep nixos-system-$job | grep drv | tail -n1 | sed 's/ //g')
|
|
echo $old_job
|
|
echo $new_job
|
|
echo "<details>" >> report
|
|
echo "<summary>expression difference for $job</summary>" >> report
|
|
echo '```' >> report
|
|
nix run 'nixpkgs#nix-diff' $old_job $new_job >> report
|
|
echo '```' >> report
|
|
echo "</details>" >> report
|
|
done
|
|
|
|
if [ "$(wc -c report | awk '{print $1}')" -gt 131072 ]; then
|
|
mv report report-artifact.txt
|
|
echo "Difference is too large for github. Please check the artifact" > report
|
|
echo ::set-output name=artifact::report-artifact.txt
|
|
fi
|
|
|
|
body=$(cat report)
|
|
body="${body//'%'/'%25'}"
|
|
body="${body//$'\n'/'%0A'}"
|
|
body="${body//$'\r'/'%0D'}"
|
|
echo ::set-output name=body::$body
|
|
- uses: actions/upload-artifact@v3
|
|
if: steps.update-step.outputs.artifact != ''
|
|
with:
|
|
name: deriv-diff
|
|
path: ${{ github.workspace }}/${{ steps.update-step.outputs.artifact }}
|
|
- uses: peter-evans/create-pull-request@v4
|
|
if: steps.update-step.outputs.body != ''
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
body: ${{ steps.update-step.outputs.body }}
|
|
commit-message: Update flake.lock
|
|
committer: GitHub <noreply@github.com>
|
|
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
|
branch: update-flake
|
|
delete-branch: true
|
|
title: "Update flake.nix"
|
|
labels: |
|
|
update
|
|
automated
|
|
assignees: darkkirb
|
|
reviewers: darkkirb
|
|
add-paths: flake.lock
|