feat(managementasset): Authenticate GitHub API requests
Unified · Split
| @@ -159,6 +159,10 @@ func fetchLatestAsset(ctx context.Context, client *http.Client) (*releaseAsset, · 158 unmodified lines | ||
| 159 | 159 | } |
| 160 | 160 | req.Header.Set("Accept", "application/vnd.github+json") |
| 161 | 161 | req.Header.Set("User-Agent", httpUserAgent) |
| 162 | + gitURL := strings.ToLower(strings.TrimSpace(os.Getenv("GITSTORE_GIT_URL"))) | |
| 163 | + if tok := strings.TrimSpace(os.Getenv("GITSTORE_GIT_TOKEN")); tok != "" && strings.Contains(gitURL, "github.com") { | |
| 164 | + req.Header.Set("Authorization", "Bearer "+tok) | |
| 165 | + } | |
| 162 | 166 | |
| 163 | 167 | resp, err := client.Do(req) |
| 164 | 168 | if err != nil { |