-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (87 loc) · 2.54 KB
/
update.yml
File metadata and controls
90 lines (87 loc) · 2.54 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: "Automated update"
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
push:
branches:
- master
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
# use PAT for git push to trigger github actions
token: ${{ secrets.PAT_FOR_CREATE_PULL_REQUEST }}
- name: Prepare branch
run: |
git checkout master
git branch --force update master
git checkout update
- name: Install nix
uses: cachix/install-nix-action@master
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup cachix
uses: cachix/cachix-action@master
with:
name: linyinfeng
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Cache
uses: actions/cache@main
with:
path: |
pkgs/_sources/.shake.database
key: ${{ runner.os }}-${{ hashFiles('pkgs/dev-packages/nvfetcher-self/src/*') }}-${{ hashFiles('pkgs/_sources/generated.nix') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('pkgs/dev-packages/nvfetcher-self/src/*') }}-
- name: Git config
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup nvchecker key file
run: |
cat > keyfile.toml <<EOF
[keys]
github = "${{ secrets.GITHUB_TOKEN }}"
EOF
- name: Run locale-gen
run: |
sudo locale-gen en_US.UTF-8
- name: Run update
id: update
env:
LANG: en_US.UTF-8
run: |
# update and set variables
# - CHANGELOG
nix run .#devPackages/update
- name: Push to remote
run: |
git push --set-upstream origin update --force
- name: Create pull request
run: |
cat >/tmp/body-file <<'EOF'
###### Changelog
```text
${{ steps.update.outputs.changelog }}
```
EOF
gh pr create \
--base master \
--title 'Automated update' \
--body-file /tmp/body-file \
--head update \
--assignee linyinfeng \
--reviewer linyinfeng \
--label 'auto merge' \
--label 'auto update' || \
gh pr edit update \
--body-file /tmp/body-file
env:
GITHUB_TOKEN: ${{ secrets.PAT_FOR_CREATE_PULL_REQUEST }}