-
Notifications
You must be signed in to change notification settings - Fork 31
46 lines (38 loc) · 1.39 KB
/
dependencies.yml
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
# this approach is indebted to this blog post from GitHub user hallettj:
# https://sitr.us/2024/03/08/nix-npm-and-dependabot.html
name: Update gomod2nix.toml upon Dependabot changes to Go dependencies
on:
push:
branches:
- "dependabot/go_modules/**"
jobs:
update_gomod2nix_toml_file:
name: Update gomod2nix.toml if Go dependencies have changed
runs-on: ubuntu-22.04
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v11
- name: Use Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v6
- name: Update gomod2nix.toml (if go.mod has changed)
run: |
nix develop --command gomod2nix
- name: Set up Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Commit changes
run: |
git add .
if [[ $(git status -s) ]]; then
git commit -m "build(deps): update gomod2nix.toml [dependabot skip]" --no-verify
git push
echo "pushed an update to gomod2nix.toml"
else
echo "go dependencies have not changed"
fi