-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.51 KB
/
Copy pathupdate.yml
File metadata and controls
70 lines (60 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: "Flake Update"
on:
schedule:
- cron: '30 16 * * 6'
workflow_dispatch:
jobs:
build-system:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: Substituters
id: substituters
run: |
echo "TRUSTED_PUBLIC_KEYS=$(./nix.sh ci_get trusted-public-keys)" >> "$GITHUB_OUTPUT"
echo "SUBSTITUTERS=$(./nix.sh ci_get trusted-substituters)" >> "$GITHUB_OUTPUT"
- uses: samueldr/lix-gha-installer-action@latest
name: "Install Lix"
with:
extra_nix_config: |
trusted-public-keys = ${{ steps.substituters.outputs.TRUSTED_PUBLIC_KEYS }}
substituters = ${{ steps.substituters.outputs.SUBSTITUTERS }}
experimental-features = flakes nix-command pipe-operator
accept-flake-config = true
- name: "Update flake.lock and nvfetcher"
run: |
nix --accept-flake-config --show-trace --print-build-logs --verbose flake update 2>&1 | tee flake-update.txt
nix develop .#ci --command bash -c nvfetcher 2>&1 | tee nvfetcher-update.txt
- name: "Write changelog"
id: changelog
run: |
echo "commit_msg=$(echo "chore: update flake.lock & sources ($(date -I))")" >> "$GITHUB_OUTPUT"
echo "date_week=$(date +%V)" >> "$GITHUB_OUTPUT"
echo "date_year=$(date +%Y)" >> "$GITHUB_OUTPUT"
echo "body_file=$PWD/changelog.txt" >> "$GITHUB_OUTPUT"
echo "Automated Pull Request for Week $(date +%V)" > changelog.txt
echo "" >> changelog.txt
echo "Flakes Changelog:" >> changelog.txt
echo "\`\`\`" >> changelog.txt
(grep -E "'\s\(|Updated input" flake-update.txt || echo "No changes!") >> changelog.txt
echo "\`\`\`" >> changelog.txt
echo "" >> changelog.txt
echo "Sources Changelog:" >> changelog.txt
echo "\`\`\`" >> changelog.txt
(grep -E "→" nvfetcher-update.txt || echo "No changes!") >> changelog.txt
echo "\`\`\`" >> changelog.txt
nix fmt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: ${{ steps.changelog.outputs.commit_msg }}
token: ${{ secrets.PR_CREATOR }}
commit-message: ${{ steps.changelog.outputs.commit_msg }}
add-paths: |
_sources/*
flake.lock
signoff: true
delete-branch: true
branch: flake-update/${{ steps.changelog.outputs.date_year }}-${{ steps.changelog.outputs.date_week }}
body-path: ${{ steps.changelog.outputs.body_file }}