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)
| 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 |
| 39 | func 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. |