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

feat: drop dependency on gh #1000

Merged
merged 16 commits into from
Aug 15, 2024
Merged

feat: drop dependency on gh #1000

merged 16 commits into from
Aug 15, 2024

Conversation

JoshuaKGoldberg
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg commented Oct 30, 2023

PR Checklist

Overview

Replaces the end-user dependency on gh (the GitHub CLI) with more manual Octokit calls. It's a bit less convenient this way but is more type-safe and means users don't need to have some random GitHub utility installed to use the template.

Update December 2023: this works but I don't like how the user has to either have gh logged in or use a process.env.GH_TOKEN... I'd like to find the time to look into alternatives to log the user in.

Update August 2024: I don't want to procrastinate any more. This PR doesn't make things worse. So as long as error messages explicitly tell people to either log in with gh or set process.env.GH_TOKEN, this is fine.

@JoshuaKGoldberg JoshuaKGoldberg changed the title [WIP] feat: drop dependency on gh feat: drop dependency on gh Dec 7, 2023
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review December 7, 2023 19:28
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (b3c7970) 94.18% compared to head (7fb6308) 94.21%.
Report is 1 commits behind head on main.

Files Patch % Lines
src/create/createWithOptions.ts 0.00% 1 Missing ⚠️
src/initialize/initializeWithOptions.ts 0.00% 1 Missing ⚠️
src/steps/initializeGitHubRepository/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1000      +/-   ##
==========================================
+ Coverage   94.18%   94.21%   +0.03%     
==========================================
  Files          97       97              
  Lines        5620     5667      +47     
  Branches      457      462       +5     
==========================================
+ Hits         5293     5339      +46     
- Misses        326      327       +1     
  Partials        1        1              
Flag Coverage Δ
create 69.61% <9.52%> (-0.64%) ⬇️
initialize 41.67% <14.28%> (-0.49%) ⬇️
migrate 68.95% <9.52%> (-0.63%) ⬇️
unit 72.38% <96.42%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft December 31, 2023 21:13
@JoshuaKGoldberg
Copy link
Owner Author

For retrieving a user auth token, JoshuaKGoldberg/prune-github-notifications#167 also tracks creating a standalone package.

@JoshuaKGoldberg
Copy link
Owner Author

The not having a better way than gh or a manual process.env.GH_TOKEN is irksome, but IMO shouldn't block this from going in. I'll just add in some friendly messaging in the process of retrieving the user's GH auth token.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review August 15, 2024 15:49
}
} catch (error) {
throw new Error("Failed to create new repository on GitHub.", {
cause: error,
Copy link
Owner Author

Choose a reason for hiding this comment

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

Not strictly necessary for this PR, but the bad error was bugging me when I was testing out permissions. 😄

@JoshuaKGoldberg JoshuaKGoldberg merged commit 063346e into main Aug 15, 2024
15 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the drop-the-gh branch August 15, 2024 16:01
Copy link

🎉 This is included in version v1.71.0 🎉

The release is available on:

Cheers! 📦🚀

@JoshuaKGoldberg JoshuaKGoldberg removed the status: waiting for author Needs an action taken by the original poster label Aug 27, 2024
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.

🚀 Feature: Drop end-user dependency on gh
1 participant