Skip to content

Add GITHUB_REF_TYPE and GITHUB_REF_NAME support to github context #935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DenKoren
Copy link

Hope it is all changes required to pass ref_type info from env to github context.
It's first time I touch actions toolkit and I'm not sure if I hadn't miss something.

@DenKoren DenKoren requested a review from a team as a code owner November 18, 2021 17:04
@DenKoren DenKoren changed the title Add GITHUB_REF_TYPE support to github context Add GITHUB_REF_TYPE and GITHUB_REF_NAME support to github context Nov 18, 2021
@peaceiris
Copy link
Contributor

Why don't you add GITHUB_REF_PROTECTED? :)

cf. https://docs.github.com/en/actions/learn-github-actions/environment-variables

@DenKoren
Copy link
Author

DenKoren commented Nov 19, 2021

Done. :)
If there's a better way to cast the env value to boolean, please let me know. I'm newbie in TypeScript.

@dbritto-dev
Copy link

@peaceiris can we merge this ?

@@ -40,6 +43,9 @@ export class Context {
this.eventName = process.env.GITHUB_EVENT_NAME as string
this.sha = process.env.GITHUB_SHA as string
this.ref = process.env.GITHUB_REF as string
this.refName = process.env.GITHUB_REF_NAME as string
this.refType = process.env.GITHUB_REF_TYPE as string
this.refProtected = (process.env.GITHUB_REF_PROTECTED as string) === 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GITHUB_REF_PROTECTED is expected to have true, so I think the current implementation is sufficient. We need the opinion of the maintainers about this.

cf. https://docs.github.com/en/actions/learn-github-actions/environment-variables

@peaceiris
Copy link
Contributor

LGTM

@DenKoren
Copy link
Author

How to get the approval from actions/actions-runtime? Seems it is the only thing left before merge.

@igreg
Copy link

igreg commented Jun 18, 2025

FYI @GhadimiR @Link- would you be able to review/approve this PR?
The change seems relatively straightforward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants