[PR #2651] [MERGED] Use gh auth token for default GITHUB_TOKEN secret #2534

Closed
opened 2026-03-01 21:55:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/2651
Author: @ChristopherHX
Created: 2/8/2025
Status: Merged
Merged: 2/9/2025
Merged by: @mergify[bot]

Base: masterHead: gh-cli-auth


📝 Commits (1)

  • 1849cad Use gh auth token for default GITHUB_TOKEN secret

📊 Changes

3 files changed (+61 additions, -0 deletions)

View changed files

📝 cmd/root.go (+10 -0)
pkg/gh/gh.go (+40 -0)
pkg/gh/gh_test.go (+11 -0)

📄 Description

  • initial version

Closes https://github.com/nektos/gh-act/issues/8

The readEnvs function should be rewritten to apply ToUpper for the secrets keys (not for env variables) like for newSecrets so the following can get refactored to just check for GITHUB_TOKEN

		hasGitHubToken := false
		for k := range secrets {
			if strings.EqualFold(k, "GITHUB_TOKEN") {
				hasGitHubToken = true
			}
		}

I considered to not make this conditionally and skipped the ghes auto detection. Now act will always have a ${{ github.token }} value if gh is installed and authenticated.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/2651 **Author:** [@ChristopherHX](https://github.com/ChristopherHX) **Created:** 2/8/2025 **Status:** ✅ Merged **Merged:** 2/9/2025 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `gh-cli-auth` --- ### 📝 Commits (1) - [`1849cad`](https://github.com/nektos/act/commit/1849cad1c7c310f51e9e8f25d6808ca96cf2bdc2) Use gh auth token for default GITHUB_TOKEN secret ### 📊 Changes **3 files changed** (+61 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/root.go` (+10 -0) ➕ `pkg/gh/gh.go` (+40 -0) ➕ `pkg/gh/gh_test.go` (+11 -0) </details> ### 📄 Description * initial version Closes https://github.com/nektos/gh-act/issues/8 The readEnvs function should be rewritten to apply ToUpper for the secrets keys (not for env variables) like for newSecrets so the following can get refactored to just check for `GITHUB_TOKEN` ```go hasGitHubToken := false for k := range secrets { if strings.EqualFold(k, "GITHUB_TOKEN") { hasGitHubToken = true } } ``` I considered to not make this conditionally and skipped the ghes auto detection. Now act will always have a `${{ github.token }}` value if `gh` is installed and authenticated. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:55:51 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#2534
No description provided.