Skip to content

Commit e224adf

Browse files
Pass GitHub run attempt ID to OIDC exchange
1 parent 0b72835 commit e224adf

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pkg/oidc/actionspublic/exchange.go

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func RetrieveToken(ctx context.Context, audience string) (string, error) {
1919
runID := os.Getenv("GITHUB_RUN_ID")
2020
eventName := os.Getenv("GITHUB_EVENT_NAME")
2121
eventPath := os.Getenv("GITHUB_EVENT_PATH")
22+
attempt := os.Getenv("GITHUB_RUN_ATTEMPT")
2223

2324
// Skip if not running in a GitHub Actions environment
2425
if runID == "" || eventName == "" || eventPath == "" {
@@ -58,6 +59,7 @@ func RetrieveToken(ctx context.Context, audience string) (string, error) {
5859
EventName: eventName,
5960
Repo: payload.Repository.FullName,
6061
RunID: runID,
62+
Attempt: attempt,
6163
})
6264
if err != nil {
6365
return "", err

pkg/oidc/actionspublic/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type ClaimRequest struct {
2727
EventName string `json:"eventName"`
2828
Repo string `json:"repo"`
2929
RunID string `json:"runID"`
30+
Attempt string `json:"attempt"`
3031
}
3132

3233
type ChallengeResponse struct {

0 commit comments

Comments
 (0)