github / github/local-action

Unable to get the ACTIONS_RUNTIME_TOKEN env variable

Abierto
#282 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
451
Forks
28
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hello, I have encountered an error when trying to upload an artifact.

In my .env I have Artifact path setup:
```
LOCAL_ACTION_WORKSPACE="/tmp"
LOCAL_ACTION_ARTIFACT_PATH="/tmp/artifacts"
GITHUB_STEP_SUMMARY="/tmp/summary.md"
```

In my code I use artifact upload in an uncomplicated way (Hopefully):
```
let batchStatus: CTRFReport
do {
core.info('Waiting for test batch to finish.')
await sleep(batchWaitTimeout)
batchStatus = await getBatchStatus(apiUrl, apiKey, batchId)
core.debug(JSON.stringify(batchStatus))
} while (testBatchStillRunning(batchStatus))

core.setOutput('batchId', batchId)
await writeFile(batchStatusFilepath, JSON.stringify(batchStatus), 'utf-8')
await artifact.uploadArtifact('batch-status', [batchStatusFilepath], '.')
```

But when I run my action via `npx @github/local-action . src/main.ts .env`
I get the following error.
```
Artifact name is valid!
Root directory input is valid!
/home/vhodina/git/run/node_modules/@actions/artifact/lib/internal/shared/config.js:18
throw new Error('Unable to get the ACTIONS_RUNTIME_TOKEN env variable');
^

Error: Unable to get the ACTIONS_RUNTIME_TOKEN env variable
at getRuntimeToken (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/shared/config.ts:13:11)
at getBackendIdsFromToken (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/shared/util.ts:22:32)
at (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/upload/upload-artifact.ts:44:44)
at Generator.next ()
at /home/vhodina/git/run/node_modules/@actions/artifact/lib/internal/upload/upload-artifact.js:31:71
at new Promise ()
at __awaiter (/home/vhodina/git/run/node_modules/@actions/artifact/lib/internal/upload/upload-artifact.js:27:12)
at uploadArtifact (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/upload/upload-artifact.ts:28:46)
at DefaultArtifactClient. (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/client.ts:124:28)
at Generator.next ()

Node.js v25.9.0

Error: Command failed: npm exec tsx "/home/vhodina/git/run/node_modules/@github/local-action/src/index.ts" -- . src/main.ts .env
at genericNodeError (node:internal/errors:998:15)
at wrappedFn (node:internal/errors:543:14)
at checkExecSyncError (node:child_process:925:11)
at execSync (node:child_process:997:15)
at entrypoint (file:///home/vhodina/git/run/node_modules/@github/local-action/bin/local-action.js:108:5)
at file:///home/vhodina/git/run/node_modules/@github/local-action/bin/local-action.js:121:1
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async node:internal/modules/esm/loader:639:26
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 22814,
stdout: null,
stderr: null
}
```

I'm not sure if the error is caused by local-action or my setup.
I've tried defining the `ACTIONS_RUNTIME_TOKEN` in .env, but that ends up with the promise failing with different error.

The whole action is available at https://github.com/aiva-actions/run

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Reproduce el fallo con `npx @github/local-action . src/main.ts .env`, utilizando la llamada `artifact.uploadArtifact` y los valores de entorno indicados. Empieza rastreando cómo local-action carga `.env` para `src/main.ts` y cómo el cliente de artifacts obtiene su contexto de ejecución; se considerará terminado cuando se haya establecido si esta invocación es compatible y se haya documentado el comportamiento resultante o un alcance concreto para la corrección.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
github, nodejs, typescript
Área
developer-experience, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.