Skip to content

Unable to get the ACTIONS_RUNTIME_TOKEN env variable #282

@vasekhodina

Description

@vasekhodina

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 <anonymous> (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/upload/upload-artifact.ts:44:44)
    at Generator.next (<anonymous>)
    at /home/vhodina/git/run/node_modules/@actions/artifact/lib/internal/upload/upload-artifact.js:31:71
    at new Promise (<anonymous>)
    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.<anonymous> (/home/vhodina/git/run/node_modules/@actions/artifact/src/internal/client.ts:124:28)
    at Generator.next (<anonymous>)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions