actions / actions/toolkit

Get matrix from inside an action

Open
#586 1 comment 4 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
I'd like to access the matrix from a custom action.

Additional information
I'm working on an action that uploads a couple log files as artifacts after the job is complete. I'm trying to keep the action as minimal as possible, so it can work without specifying inputs (using defaults).

By default, the artifact name is formatted as JOB_ID-log. Obviously, this name is ambiguous when there is a build matrix. I'd like to use the matrix to generate a unique name, so I can upload each of them to the artifact store. Unfortunately, I can't find an easy way to access the matrix information using toolkit.

I considered the following alternatives:

  • Use a unique ID: I'd like to match the artifact name to the actual build, so this isn't really a good solution.
  • Pass the matrix as input or env: this would require the user to manually pass the matrix to the action which is error prone.

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

No file or test is named in the issue. Start by locating the toolkit's context APIs and reviewing how GitHub Actions exposes matrix data to custom actions; done means an action can derive a unique artifact name from the matrix without requiring users to pass it manually as an input or environment variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, developer-experience
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.