Rename GitHub specific types

This change renames a lot of variables, types and functions to be more
generic. The goal is to allow GARM to add more forges in the future.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-05-12 21:47:13 +00:00
parent 4890eb4732
commit 40e6581a75
72 changed files with 896 additions and 700 deletions

View file

@ -283,12 +283,12 @@ func parsePrivateKeyFromPath(path string) ([]byte, error) {
func parseCredentialsAddParams() (ret params.CreateGithubCredentialsParams, err error) {
ret.Name = credentialsName
ret.Description = credentialsDescription
ret.AuthType = params.GithubAuthType(credentialsType)
ret.AuthType = params.ForgeAuthType(credentialsType)
ret.Endpoint = credentialsEndpoint
switch ret.AuthType {
case params.GithubAuthTypePAT:
case params.ForgeAuthTypePAT:
ret.PAT.OAuth2Token = credentialsOAuthToken
case params.GithubAuthTypeApp:
case params.ForgeAuthTypeApp:
ret.App.InstallationID = credentialsAppInstallationID
ret.App.AppID = credentialsAppID
keyContents, err := parsePrivateKeyFromPath(credentialsPrivateKeyPath)

View file

@ -252,7 +252,7 @@ func parseCreateParams() (params.CreateGithubEndpointParams, error) {
return ret, nil
}
func formatEndpoints(endpoints params.GithubEndpoints) {
func formatEndpoints(endpoints params.ForgeEndpoints) {
if outputFormat == common.OutputFormatJSON {
printAsJSON(endpoints)
return
@ -274,7 +274,7 @@ func formatEndpoints(endpoints params.GithubEndpoints) {
fmt.Println(t.Render())
}
func formatOneEndpoint(endpoint params.GithubEndpoint) {
func formatOneEndpoint(endpoint params.ForgeEndpoint) {
if outputFormat == common.OutputFormatJSON {
printAsJSON(endpoint)
return