Skip to content

Commit e6bb9c6

Browse files
committed
Avoid Windows trust prompts in local HTTPS CI
Assisted-By: devx/05def498-8bdd-48d0-bd5e-35e4667a2f3d
1 parent 147a26f commit e6bb9c6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,23 @@ jobs:
8686
run: pnpm install --frozen-lockfile
8787

8888
- name: Provision local HTTPS certificate
89+
if: runner.os != 'Windows'
8990
run: pnpm https:setup
9091

92+
- name: Provision local HTTPS certificate on Windows
93+
if: runner.os == 'Windows'
94+
shell: pwsh
95+
env:
96+
# GitHub-hosted runners cannot accept Windows' root-store prompt.
97+
# Generate the same CA and provide it directly to Node's TLS verifier.
98+
TRUST_STORES: none
99+
run: |
100+
pnpm https:setup
101+
$rootCertificate = Join-Path $env:LOCALAPPDATA 'mkcert\rootCA.pem'
102+
if (!(Test-Path $rootCertificate)) {
103+
throw "mkcert root CA was not created at $rootCertificate"
104+
}
105+
Add-Content -Path $env:GITHUB_ENV -Value "NODE_EXTRA_CA_CERTS=$rootCertificate"
106+
91107
- name: Verify trusted local HTTPS
92108
run: pnpm run test:local-https

0 commit comments

Comments
 (0)