Skip to content

Accessing GH context in actions #26326

Discussion options

You must be logged in to vote

I don’t think it’s currently possible to access the context directly.

Consider github-script, which provides a partial context containing some of the items from the workflow github context. That partial context is actually just rehydrated from the environment. If it were possible to get the real context directly it would make sense for github-script to do that. The fact it doesn’t suggests it’s not possible.

One workaround is to add inputs to your action, but set the default using the context, eg:

  <a href="https://github.com/actions/github-script/blob/00e1b58cd9e040d944127e75b3d9df586e4b0479/action.yml#L13" target="_blank" rel="noopener nofollow ugc">github.com</a>

actions/github-scrip…

Replies: 5 suggested answers

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment