Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gh auth token for default GITHUB_TOKEN secret #2651

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

ChristopherHX
Copy link
Contributor

  • initial version

Closes nektos/gh-act#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.

@ChristopherHX ChristopherHX requested a review from a team as a code owner February 8, 2025 20:27
@ChristopherHX
Copy link
Contributor Author

act -s GITHUB_TOKEN= should disable this feature (like putting in the secrets file) if I'm not mistaken

Copy link

codecov bot commented Feb 8, 2025

Codecov Report

Attention: Patch coverage is 51.51515% with 16 lines in your changes missing coverage. Please review.

Project coverage is 68.58%. Comparing base (5a80a04) to head (1849cad).
Report is 163 commits behind head on master.

Files with missing lines Patch % Lines
cmd/root.go 0.00% 8 Missing ⚠️
pkg/gh/gh.go 68.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2651      +/-   ##
==========================================
+ Coverage   61.56%   68.58%   +7.02%     
==========================================
  Files          53       72      +19     
  Lines        9002    11046    +2044     
==========================================
+ Hits         5542     7576    +2034     
+ Misses       3020     2900     -120     
- Partials      440      570     +130     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mergify mergify bot merged commit cb26fd8 into nektos:master Feb 9, 2025
12 checks passed
@ChristopherHX ChristopherHX deleted the gh-cli-auth branch February 9, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compile act cmd package with a built tag to grab gh cli auth and host info automatically
2 participants