Skip to content

Commit

Permalink
Update mappings for GH context objects (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianrath committed Jan 2, 2024
1 parent b103b23 commit f4229d1
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions nodes/gh.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,36 @@ func RemoveGhSecret(name string) {

func initGhContexts() {

ghContext["github.workspace"] = os.Getenv("GITHUB_WORKSPACE")
ghContext["github.repository"] = os.Getenv("GITHUB_REPOSITORY")
// For more information on the githubs context, see:
// https://docs.github.com/en/actions/learn-github-actions/contexts

ghContext["github.action"] = os.Getenv("GITHUB_ACTION")
// No direct mapping for 'github.action_path'
ghContext["github.actor"] = os.Getenv("GITHUB_ACTOR")
ghContext["github.actor_id"] = os.Getenv("GITHUB_ACTOR_ID")
ghContext["github.api_url"] = os.Getenv("GITHUB_API_URL")
ghContext["github.base_ref"] = os.Getenv("GITHUB_BASE_REF")
ghContext["github.env"] = os.Getenv("GITHUB_ENV")
ghContext["github.event_name"] = os.Getenv("GITHUB_EVENT_NAME")
ghContext["github.event_path"] = os.Getenv("GITHUB_EVENT_PATH")
ghContext["github.graphql_url"] = os.Getenv("GITHUB_GRAPHQL_URL")
// No direct mapping for 'github.head_ref'
ghContext["github.job"] = os.Getenv("GITHUB_JOB")
ghContext["github.ref"] = os.Getenv("GITHUB_REF")
// No direct mapping for 'github.ref'
ghContext["github.ref_name"] = os.Getenv("GITHUB_REF_NAME")
// No direct mapping for 'github.ref_protected'
// No direct mapping for 'github.ref_type'
ghContext["github.repository"] = os.Getenv("GITHUB_REPOSITORY")
ghContext["github.repository_id"] = os.Getenv("GITHUB_REPOSITORY_ID")
ghContext["github.repository_owner"] = os.Getenv("GITHUB_REPOSITORY_OWNER")
ghContext["github.repository_owner_id"] = os.Getenv("GITHUB_REPOSITORY_OWNER_ID")
ghContext["github.run_attempt"] = os.Getenv("GITHUB_RUN_ATTEMPT")
ghContext["github.run_id"] = os.Getenv("GITHUB_RUN_ID")
ghContext["github.run_number"] = os.Getenv("GITHUB_RUN_NUMBER")
ghContext["github.server_url"] = os.Getenv("GITHUB_SERVER_URL")
ghContext["github.sha"] = os.Getenv("GITHUB_SHA")
ghContext["github.event_name"] = os.Getenv("GITHUB_EVENT_NAME")
ghContext["github.workflow"] = os.Getenv("GITHUB_WORKFLOW")
// No direct mapping for 'github.workflow'
ghContext["github.workspace"] = os.Getenv("GITHUB_WORKSPACE")

// As outlined in the documentation, secrets.GITHUB_TOKEN and github.token
// are functionally equivalent. See:
Expand Down

0 comments on commit f4229d1

Please sign in to comment.