actions / actions/toolkit

Feature request: split context out from @actions/github

Open
#430 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the enhancement
The information provided by the github.context object provided by the @actions/github package provides a lot of useful information about why an action has been invoked. It doesn't necessarily follow that code using this information will also access the Github REST API.

Importing the package and making a simple access to github.context significantly increased the compile time, and added almost 600 KB to the packed version of my action. That seems a bit excessive.

It would be nice if I could get access to the context information without pulling in all of Octokit. It almost feels like it would make sense in @actions/core, although maybe the information isn't quite that universally useful.

Additional information
I realise I can reach into the package's internals to get the context only with something like:

import {Context} from '@actions/github/lib/context.js'
const context = new Context()

But there is no guarantee that that will continue to work as new versions are released.

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 by reading the public @actions/github package entry points and the existing @actions/github/lib/context.js implementation. Compare how @actions/core exposes shared functionality and determine where Context should be publicly provided without pulling in Octokit. Done means context is available through a supported package API while preserving the intended action context behavior and reducing unnecessary bundle and compile-time cost.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.