Skip to content

Commit 09fc534

Browse files
authored
actions: added GITHUB_ACTOR_ID to Context (#58)
* actions: added `GITHUB_ACTOR_ID` to Context https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables * chore: remove unused env tag
1 parent a3b47ba commit 09fc534

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

actions.go

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -459,44 +459,45 @@ type GetenvFunc func(key string) string
459459
//
460460
// See: https://docs.github.com/en/actions/learn-github-actions/environment-variables
461461
type GitHubContext struct {
462-
Action string `env:"GITHUB_ACTION"`
463-
ActionPath string `env:"GITHUB_ACTION_PATH"`
464-
ActionRepository string `env:"GITHUB_ACTION_REPOSITORY"`
465-
Actions bool `env:"GITHUB_ACTIONS"`
466-
Actor string `env:"GITHUB_ACTOR"`
467-
APIURL string `env:"GITHUB_API_URL,default=https://api.github.com"`
468-
BaseRef string `env:"GITHUB_BASE_REF"`
469-
Env string `env:"GITHUB_ENV"`
470-
EventName string `env:"GITHUB_EVENT_NAME"`
471-
EventPath string `env:"GITHUB_EVENT_PATH"`
472-
GraphqlURL string `env:"GITHUB_GRAPHQL_URL,default=https://api.github.com/graphql"`
473-
HeadRef string `env:"GITHUB_HEAD_REF"`
474-
Job string `env:"GITHUB_JOB"`
475-
Path string `env:"GITHUB_PATH"`
476-
Ref string `env:"GITHUB_REF"`
477-
RefName string `env:"GITHUB_REF_NAME"`
478-
RefProtected bool `env:"GITHUB_REF_PROTECTED"`
479-
RefType string `env:"GITHUB_REF_TYPE"`
462+
Action string
463+
ActionPath string
464+
ActionRepository string
465+
Actions bool
466+
Actor string
467+
ActorID string
468+
APIURL string
469+
BaseRef string
470+
Env string
471+
EventName string
472+
EventPath string
473+
GraphqlURL string
474+
HeadRef string
475+
Job string
476+
Path string
477+
Ref string
478+
RefName string
479+
RefProtected bool
480+
RefType string
480481

481482
// Repository is the owner and repository name. For example, octocat/Hello-World
482483
// It is not recommended to use this field to acquire the repository name
483484
// but to use the Repo method instead.
484-
Repository string `env:"GITHUB_REPOSITORY"`
485+
Repository string
485486

486487
// RepositoryOwner is the repository owner. For example, octocat
487488
// It is not recommended to use this field to acquire the repository owner
488489
// but to use the Repo method instead.
489-
RepositoryOwner string `env:"GITHUB_REPOSITORY_OWNER"`
490-
491-
RetentionDays int64 `env:"GITHUB_RETENTION_DAYS"`
492-
RunAttempt int64 `env:"GITHUB_RUN_ATTEMPT"`
493-
RunID int64 `env:"GITHUB_RUN_ID"`
494-
RunNumber int64 `env:"GITHUB_RUN_NUMBER"`
495-
ServerURL string `env:"GITHUB_SERVER_URL,default=https://github.com"`
496-
SHA string `env:"GITHUB_SHA"`
497-
StepSummary string `env:"GITHUB_STEP_SUMMARY"`
498-
Workflow string `env:"GITHUB_WORKFLOW"`
499-
Workspace string `env:"GITHUB_WORKSPACE"`
490+
RepositoryOwner string
491+
492+
RetentionDays int64
493+
RunAttempt int64
494+
RunID int64
495+
RunNumber int64
496+
ServerURL string
497+
SHA string
498+
StepSummary string
499+
Workflow string
500+
Workspace string
500501

501502
// Event is populated by parsing the file at EventPath, if it exists.
502503
Event map[string]any
@@ -577,6 +578,9 @@ func (c *Action) Context() (*GitHubContext, error) {
577578
if v := c.getenv("GITHUB_ACTOR"); v != "" {
578579
githubContext.Actor = v
579580
}
581+
if v := c.getenv("GITHUB_ACTOR_ID"); v != "" {
582+
githubContext.ActorID = v
583+
}
580584
if v := c.getenv("GITHUB_API_URL"); v != "" {
581585
githubContext.APIURL = v
582586
}

0 commit comments

Comments
 (0)