Skip to content

Commit c46acac

Browse files
fengmk2claude
andcommitted
feat: change run-install default to true and pass github-token to vite install
- Change default value of run-install from false to true - Pass VP_TOKEN environment variable when running vite install with GitHub Package Registry, ensuring dependencies can be installed from the private registry - Update test workflow to explicitly set run-install: false for jobs that don't need to run vite install Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8d3dcad commit c46acac

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
version: latest
2727
registry: github
2828
github-token: ${{ secrets.VP_TOKEN }}
29+
run-install: false
2930
cache: false
3031

3132
- name: Verify installation
@@ -54,6 +55,7 @@ jobs:
5455
with:
5556
registry: github
5657
github-token: ${{ secrets.VP_TOKEN }}
58+
run-install: false
5759
cache: true
5860
cache-dependency-path: pnpm-lock.yaml
5961

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ inputs:
2020
run-install:
2121
description: 'Run `vite install` after setup. Accepts boolean or YAML object with cwd/args.'
2222
required: false
23-
default: 'false'
23+
default: 'true'
2424
cache:
2525
description: 'Enable caching of project dependencies'
2626
required: false

dist/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/run-install.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
import { startGroup, endGroup, setFailed, info } from "@actions/core";
1+
import { startGroup, endGroup, setFailed, info, debug } from "@actions/core";
22
import { exec } from "@actions/exec";
33
import type { Inputs } from "./types.js";
44

55
export async function runViteInstall(inputs: Inputs): Promise<void> {
6+
const { registry, githubToken } = inputs;
7+
8+
// Set up environment for vite install
9+
const env: Record<string, string> = {};
10+
for (const [key, value] of Object.entries(process.env)) {
11+
if (value !== undefined) {
12+
env[key] = value;
13+
}
14+
}
15+
16+
// Pass GitHub token via VP_TOKEN for GitHub Package Registry
17+
if (registry === "github" && githubToken) {
18+
debug("Setting VP_TOKEN environment variable for vite install");
19+
env.VP_TOKEN = githubToken;
20+
}
21+
622
for (const options of inputs.runInstall) {
723
const args = ["install"];
824
if (options.args) {
@@ -17,6 +33,7 @@ export async function runViteInstall(inputs: Inputs): Promise<void> {
1733
try {
1834
const exitCode = await exec("vite", args, {
1935
cwd,
36+
env,
2037
ignoreReturnCode: true,
2138
});
2239

0 commit comments

Comments
 (0)