actions / actions/toolkit

Access runner.name

Open
#1,681 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Description

I want to access the name of the runner executing an action.
From runner-context I want to access:

  • runner.name
  • runner.os
  • runner.arch

For runner.os and runner.arch I can implement alternatives, but I couldn't find a way to get runner.name.

My motivation is to give artifacts unique names that are recognizable by adding the runner name to them.

Code Snipped

So for a JavaScript / TypeScript action my-action running from workflow

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}

    steps:
      - uses: username/my-action

I want to get "ubuntu-latest" and "windows-latest".

const core = require('@actions/core');

console.log(core.runner.name) // "ubuntu-latest"
console.log(core.runner.os)  // "Ubuntu 22.04.3 LTS" or similar
console.log(core.runner.arch)  // "x64"

Additional information

Similar to https://github.com/actions/toolkit/issues/599, but I only need runner context information.
Similar to capabilities documented in https://github.com/actions/toolkit/tree/main/packages/core#platform-helper, but that one isn't defined: https://github.com/actions/toolkit/issues/1630.

Versions 'n' stuff
  • @actions/core: 1.10.1
  • Node.js: 20.10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The request concerns @actions/core and the platform-helper capabilities referenced in the issue; start by reading the linked runner-context documentation and related platform-helper issue. Done means making runner.name, runner.os, and runner.arch available to JavaScript/TypeScript actions, including the matrix example, with suitable coverage in the affected package.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.