Unable to get the ACTIONS_RUNTIME_TOKEN env variable
- Langage dominant
- TypeScript
- Étoiles
- 451
- Forks
- 28
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduire l’échec avec `npx @github/local-action . src/main.ts .env`, en utilisant l’appel `artifact.uploadArtifact` et les valeurs d’environnement indiqués. Commencer par retracer la manière dont local-action charge `.env` pour `src/main.ts` et la manière dont le client d’artefacts obtient son contexte d’exécution ; le travail est terminé lorsqu’il est établi si cette invocation est prise en charge et que le comportement obtenu ou un périmètre concret de correction est documenté.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- github, nodejs, typescript
- Domaine
- developer-experience, tooling
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100