1name: Sync gomod2nix.toml
2
3on:
4 push:
5 branches: [master]
6 paths:
7 - go.mod
8 - go.sum
9 workflow_dispatch:
10
11permissions:
12 contents: write
13 pull-requests: write
14
15jobs:
16 sync:
17 runs-on: ubuntu-latest
18 steps:
19 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20
21 - name: Install Nix
22 uses: cachix/install-nix-action@ab739621df7a23f52766f9ccc97f38da6b7af14f # v31
23 with:
24 nix_path: nixpkgs=channel:nixpkgs-unstable
25
26 - name: Generate gomod2nix.toml
27 run: nix develop --command gomod2nix generate
28
29 - name: Create Pull Request
30 env:
31 GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
32 run: |
33 git diff --quiet gomod2nix.toml && exit 0
34 BRANCH="chore/sync-gomod2nix"
35 git config user.name "Floatpane Bot"
36 git config user.email "us@floatpane.com"
37 git checkout -b "$BRANCH"
38 git add gomod2nix.toml
39 git commit -m "chore: sync gomod2nix.toml"
40 git push -f origin "$BRANCH"
41 if ! gh pr list --head "$BRANCH" --state open | grep -q .; then
42 gh pr create --title "chore: sync gomod2nix.toml" --body "Automated gomod2nix.toml sync after Go dependency changes." --base master
43 fi