Skip to content

Commit d1298ea

Browse files
committed
Fix CI: safe config access in default-hooks, update workflow
default-hooks now uses $env.config? with get -o to avoid column-not-found errors when running under nu-check without a config file. Updated setup-nu action to v3.23 and use working-directory instead of shell:nu cd workaround.
1 parent 276a076 commit d1298ea

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/test-auto-venv.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- uses: hustcer/setup-nu@v3.9
19+
- uses: hustcer/setup-nu@v3.23
2020
with:
2121
version: "*"
2222
check-latest: true
2323

2424
- name: Run auto-venv tests
25-
shell: nu {0}
26-
run: |
27-
cd modules/virtual_environments/auto-venv
28-
nu test_auto_venv.nu
25+
working-directory: modules/virtual_environments/auto-venv
26+
run: nu test_auto_venv.nu

modules/virtual_environments/auto-venv/auto-venv.nu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export-env {
1919

2020

2121
def default-hooks [] {
22-
(if ($env.config.hooks.env_change.PWD != null) {
23-
$env.config.hooks.env_change.PWD
24-
}
25-
else {
22+
let existing = ($env.config? | default {} | get -o hooks.env_change.PWD)
23+
if ($existing != null) {
24+
$existing
25+
} else {
2626
[]
27-
})
27+
}
2828
}
2929

3030
def build-hooks [] {

0 commit comments

Comments
 (0)