Expose repository environment details via core
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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