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 #43

Merged
merged 2 commits into from
Feb 1, 2025
Merged

Conversation

ChristopherHX
Copy link
Contributor

Simplify first time setup by providing the auth token of the gh cli

Comment on lines +415 to +420
hasGitHubToken := false
for k := range secrets {
if strings.EqualFold(k, "GITHUB_TOKEN") {
hasGitHubToken = true
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

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

Files with missing lines Patch % Lines
cmd/root.go 0.00% 8 Missing ⚠️
pkg/gh/gh.go 68.00% 7 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
cmd/root.go 0.00% <0.00%> (ø)
pkg/gh/gh.go 68.00% <68.00%> (ø)

@ChristopherHX ChristopherHX marked this pull request as ready for review January 31, 2025 22:03
@ChristopherHX
Copy link
Contributor Author

You can test this by running

on: push
jobs:
  _:
    runs-on: self-hosted
    steps:
    - run: echo "$([[ "${{ github.token }}"  = "$(gh auth token)" ]] && echo true || echo false)"

Copy link
Contributor

@stephenwithav stephenwithav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'm still learning to use GitHub secrets, but the code looks correct.

@ChristopherHX ChristopherHX merged commit d930a54 into main Feb 1, 2025
7 checks passed
@ChristopherHX ChristopherHX deleted the gh-test branch February 1, 2025 10:07
@ChristopherHX
Copy link
Contributor Author

Thanks for your review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants