actions / toolkit

The GitHub ToolKit for developing GitHub Actions.
https://github.com/features/actions
MIT License
4.97k stars 1.43k forks source link

Feature request: split context out from @actions/github #430

Open jhenstridge opened 4 years ago

jhenstridge commented 4 years ago

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.

jhenstridge commented 4 years ago

Alternatively, it would be nice if an import like the following:

import {context} from '@actions/github'

... would eliminate the Octokit parts as dead code.