actions / actions/toolkit

Expose repository environment details via core

Open
#890 0 comments 0 reactions 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

Describe the enhancement:
Generally, I find myself wanting to use Actions in a situation where I'm running something in a repo in an org and want to take action with information about that repository/org.

It would be really lovely if core surfaced information about the environment the Action is running in by default, rather than forcing me to either find information in docs or use @actions/github to make API requests to find the information. For example:

  • What repository the Action is running in
  • What organization the Action is running in
  • What triggered the action (workflow_dispatch, cron, etc.)
  • What OS I'm running in and what machine size I'm using
  • What tools are available in the environment (it turns out it can be annoying to have to reference a random page on the docs every time!)

I'm sure there are some others that'd be good to include too.

Code Snippet

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

const repo = core.env.repo // if running in this repo, this would be `toolkit`
const org = core.env.org // if running in this repo, this would be `actions`
const trigger = core.env.trigger // if this was triggered by a workflow dispatch, `workflow_dispatch` would be an appropriate value
const os = core.env.os // if this was running in an Ubuntu machine, `ubuntu-latest` would be appropriate
const tools = core.env.tools // this would return a large object or array of all the tools available
...

Additional information
N/A

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

Start with the @actions/core API and compare the requested repository, organization, trigger, runner, and available-tool details with what @actions/github currently provides. The issue names no files or tests and leaves the final environment surface undefined, so done would require an agreed scope and corresponding coverage for the selected details.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.