Skip to content

Commit a550c3b

Browse files
committed
Update until a3b5584
1 parent f92829c commit a550c3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2661
-4517
lines changed

.github/workflows/pre-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/checkout@v4
2828
- uses: actions/setup-node@v4
2929
with:
30-
node-version: "22.x"
30+
node-version: "24.x"
3131
- uses: pnpm/action-setup@v4
3232
with:
3333
package_json_file: "frontend/package.json"
@@ -43,7 +43,7 @@ jobs:
4343
- uses: actions/checkout@v4
4444
- uses: actions/setup-go@v5
4545
with:
46-
go-version: '1.24'
46+
go-version: '1.25'
4747
- run: make lint-backend
4848
shell: bash
4949
lint:
@@ -59,7 +59,7 @@ jobs:
5959
- uses: actions/checkout@v4
6060
- uses: actions/setup-node@v4
6161
with:
62-
node-version: "22.x"
62+
node-version: "24.x"
6363
- uses: pnpm/action-setup@v4
6464
with:
6565
package_json_file: "frontend/package.json"
@@ -72,7 +72,7 @@ jobs:
7272
- uses: actions/checkout@v4
7373
- uses: actions/setup-go@v5
7474
with:
75-
go-version: '1.24'
75+
go-version: '1.25'
7676
- run: make test-backend
7777
shell: bash
7878
test:
@@ -90,7 +90,7 @@ jobs:
9090
steps:
9191
- uses: actions/setup-node@v4
9292
with:
93-
node-version: "22.x"
93+
node-version: "24.x"
9494
- uses: pnpm/action-setup@v4
9595
with:
9696
package_json_file: "frontend/package.json"
@@ -106,7 +106,7 @@ jobs:
106106
- uses: actions/checkout@v4
107107
- uses: actions/setup-go@v5
108108
with:
109-
go-version: '1.24'
109+
go-version: '1.25'
110110
- run: make build-backend
111111
shell: bash
112112

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ jobs:
9393
fetch-depth: 0
9494
- uses: actions/setup-go@v5
9595
with:
96-
go-version: '1.24'
96+
go-version: '1.25'
9797
- uses: actions/setup-node@v4
9898
with:
99-
node-version: "22.x"
99+
node-version: "24.x"
100100
- uses: pnpm/action-setup@v4
101101
with:
102102
package_json_file: "frontend/package.json"

auth/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (a *HookAuth) RunCommand() (string, error) {
103103
command[i] = os.Expand(arg, envMapping)
104104
}
105105

106-
cmd := exec.Command(command[0], command[1:]...) //nolint:gosec
106+
cmd := exec.Command(command[0], command[1:]...)
107107
cmd.Env = append(os.Environ(), fmt.Sprintf("USERNAME=%s", a.Cred.Username))
108108
cmd.Env = append(cmd.Env, fmt.Sprintf("PASSWORD=%s", a.Cred.Password))
109109
out, err := cmd.Output()

branding/banner.svg

Lines changed: 1 addition & 0 deletions
Loading

branding/icon.svg

Lines changed: 1 addition & 0 deletions
Loading

branding/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

cmd/cmd_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package cmd
2+
3+
import (
4+
"testing"
5+
6+
"github.com/samber/lo"
7+
"github.com/spf13/cobra"
8+
)
9+
10+
// TestEnvCollisions ensures that there are no collisions in the produced environment
11+
// variable names for all commands and their flags.
12+
func TestEnvCollisions(t *testing.T) {
13+
testEnvCollisions(t, rootCmd)
14+
}
15+
16+
func testEnvCollisions(t *testing.T, cmd *cobra.Command) {
17+
for _, cmd := range cmd.Commands() {
18+
testEnvCollisions(t, cmd)
19+
}
20+
21+
replacements := generateEnvKeyReplacements(cmd)
22+
envVariables := []string{}
23+
24+
for i := range replacements {
25+
if i%2 != 0 {
26+
envVariables = append(envVariables, replacements[i])
27+
}
28+
}
29+
30+
duplicates := lo.FindDuplicates(envVariables)
31+
32+
if len(duplicates) > 0 {
33+
t.Errorf("Found duplicate environment variable keys for command %q: %v", cmd.Name(), duplicates)
34+
}
35+
}

cmd/cmds_add.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ var cmdsAddCmd = &cobra.Command{
1515
Short: "Add a command to run on a specific event",
1616
Long: `Add a command to run on a specific event.`,
1717
Args: cobra.MinimumNArgs(2),
18-
RunE: python(func(_ *cobra.Command, args []string, d *pythonData) error {
19-
s, err := d.store.Settings.Get()
18+
RunE: withStore(func(_ *cobra.Command, args []string, st *store) error {
19+
s, err := st.Settings.Get()
2020
if err != nil {
2121
return err
2222
}
2323
command := strings.Join(args[1:], " ")
2424
s.Commands[args[0]] = append(s.Commands[args[0]], command)
25-
err = d.store.Settings.Save(s)
25+
err = st.Settings.Save(s)
2626
if err != nil {
2727
return err
2828
}
2929
printEvents(s.Commands)
3030
return nil
31-
}, pythonConfig{}),
31+
}, storeOptions{}),
3232
}

cmd/cmds_ls.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ var cmdsLsCmd = &cobra.Command{
1414
Short: "List all commands for each event",
1515
Long: `List all commands for each event.`,
1616
Args: cobra.NoArgs,
17-
RunE: python(func(cmd *cobra.Command, _ []string, d *pythonData) error {
18-
s, err := d.store.Settings.Get()
17+
RunE: withStore(func(cmd *cobra.Command, _ []string, st *store) error {
18+
s, err := st.Settings.Get()
1919
if err != nil {
2020
return err
2121
}
22-
evt, err := getString(cmd.Flags(), "event")
22+
23+
evt, err := cmd.Flags().GetString("event")
2324
if err != nil {
2425
return err
2526
}
@@ -32,6 +33,7 @@ var cmdsLsCmd = &cobra.Command{
3233
show["after_"+evt] = s.Commands["after_"+evt]
3334
printEvents(show)
3435
}
36+
3537
return nil
36-
}, pythonConfig{}),
38+
}, storeOptions{}),
3739
}

cmd/cmds_rm.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ including 'index_end'.`,
3535

3636
return nil
3737
},
38-
RunE: python(func(_ *cobra.Command, args []string, d *pythonData) error {
39-
s, err := d.store.Settings.Get()
38+
RunE: withStore(func(_ *cobra.Command, args []string, st *store) error {
39+
s, err := st.Settings.Get()
4040
if err != nil {
4141
return err
4242
}
@@ -55,11 +55,11 @@ including 'index_end'.`,
5555
}
5656

5757
s.Commands[evt] = append(s.Commands[evt][:i], s.Commands[evt][f+1:]...)
58-
err = d.store.Settings.Save(s)
58+
err = st.Settings.Save(s)
5959
if err != nil {
6060
return err
6161
}
6262
printEvents(s.Commands)
6363
return nil
64-
}, pythonConfig{}),
64+
}, storeOptions{}),
6565
}

0 commit comments

Comments
 (0)