MCPcopy Create free account
hub / github.com/github/gh-aw / getEffectiveSafeOutputGitHubToken

Function getEffectiveSafeOutputGitHubToken

pkg/workflow/github_token.go:39–46  ·  view source on GitHub ↗

getEffectiveSafeOutputGitHubToken returns the GitHub token to use for safe output operations, with precedence: 1. Custom token passed as parameter (e.g., from per-output config) 2. Default fallback: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} This simpler chain ensures safe outputs use

(customToken string)

Source from the content-addressed store, hash-verified

37// 2. Default fallback: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
38// This simpler chain ensures safe outputs use: safe outputs token -> GH_AW_GITHUB_TOKEN -> GitHub Actions token
39func getEffectiveSafeOutputGitHubToken(customToken string) string {
40 if customToken != "" {
41 tokenLog.Print("Using custom safe output GitHub token")
42 return customToken
43 }
44 tokenLog.Print("Using default safe output GitHub token (GH_AW_GITHUB_TOKEN || GITHUB_TOKEN)")
45 return "${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}"
46}
47
48// getEffectiveMaintenanceGitHubToken returns the configured GitHub token secret
49// expression to use for maintenance compile-workflows operations.

Calls 1

PrintMethod · 0.80

Tested by 1