Skip to content

Commit b9f4ac1

Browse files
committed
Auto-update Nix-hashes;
1 parent e4d5c27 commit b9f4ac1

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Adapt Nix hashes
2+
on:
3+
workflow_call: # 🚧 To-do: Remove this debug code.
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- "go.mod"
9+
- "go.sum"
10+
11+
concurrency:
12+
group: "${{ github.workflow }}/${{ github.ref }}"
13+
cancel-in-progress: true
14+
15+
jobs:
16+
check-tidy-go-mod:
17+
name: Adapt the hashes in Nix-package-definitions.
18+
runs-on: ubuntu-latest
19+
container:
20+
image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
# With push token that can trigger new PR jobs.
26+
token: ${{ secrets.APP_AUTOSCALER_CI_TOKEN }}
27+
28+
- name: Install Nix
29+
uses: cachix/install-nix-action@v26
30+
with:
31+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Install nix-update
34+
run: nix profile install 'nixpkgs/nixos-unstable#nix-update'
35+
36+
- name: Run nix-update
37+
shell: bash
38+
run: |
39+
#! /usr/bin/env bash
40+
set -eu -o pipefail
41+
42+
nix-update 'app-autoscaler-cli-plugin' --flake
43+
44+
declare -i -r num_changed_files="$(git status --porcelain | wc --lines)"
45+
if ((num_changed_files > 0))
46+
then
47+
echo 'Changes to some files were necessary!'
48+
declare -r tidy_message='🤖🦾🛠️ Update Nix-package-hashes'
49+
git add .
50+
git commit --message="${tidy_message}"
51+
git push
52+
else
53+
echo 'No hash-changes necessary!'
54+
fi
55+
echo '🏁'

0 commit comments

Comments
 (0)