@@ -19,60 +19,33 @@ public struct DefaultGitHandler {
1919
2020// MARK: - Actions
2121extension DefaultGitHandler : GitHandler {
22- /// Adds all changes, commits with a given message, and pushes to the remote repository.
23- /// - Parameters:
24- /// - message: The commit message describing the changes.
25- /// - path: The file path of the repository.
2622 public func commitAndPush( message: String , path: String ) throws {
2723 try shell. runAndPrint ( bash: makeGitCommand ( . addAll, path: path) )
2824 try shell. runAndPrint ( bash: makeGitCommand ( . commit( message: message) , path: path) )
2925 try shell. runAndPrint ( bash: makeGitCommand ( . push, path: path) )
3026 }
3127
32- /// Retrieves the remote URL of the repository located at the given path.
33- /// - Parameter path: The file path of the repository.
34- /// - Returns: A string representing the remote URL.
3528 public func getRemoteURL( path: String ) throws -> String {
3629 return try shell. getGitHubURL ( at: path)
3730 }
3831
39- /// Retrieves the previous release version from the repository at the given path.
40- /// - Parameter path: The file path of the repository.
41- /// - Returns: A string representing the previous release version.
4232 public func getPreviousReleaseVersion( path: String ) throws -> String {
4333 return try shell. bash ( makeGitHubCommand ( . getPreviousReleaseVersion, path: path) )
4434 }
4535
46- /// Initializes a new Git repository at the given path.
47- /// - Parameter path: The file path where the repository should be initialized.
4836 public func gitInit( path: String ) throws {
4937 try GitStarter ( path: path, shell: shell) . gitInit ( )
5038 }
5139
52- /// Initializes a new remote repository on GitHub with specified details and returns the repository URL.
53- /// - Parameters:
54- /// - tapName: The name of the remote repository.
55- /// - path: The file path where the repository is located.
56- /// - projectDetails: A description of the repository.
57- /// - visibility: The visibility of the repository (public or private).
58- /// - Returns: A string representing the repository URL.
5940 public func remoteRepoInit( tapName: String , path: String , projectDetails: String , visibility: RepoVisibility ) throws -> String {
6041 let info = RepoInfo ( name: tapName, details: projectDetails, visibility: visibility, canUploadFromNonMainBranch: false )
6142 return try GitHubRepoStarter ( path: path, shell: shell, repoInfo: info) . repoInit ( )
6243 }
6344
64- /// Creates a new release with one or more archived binaries and returns all asset URLs.
65- /// - Parameters:
66- /// - version: The version number for the release.
67- /// - archivedBinaries: The archived binary files to upload to the release.
68- /// - releaseNoteInfo: Information for generating release notes.
69- /// - path: The file path of the repository.
70- /// - Returns: An array of asset URLs, with the primary asset URL first, followed by additional asset URLs.
7145 public func createNewRelease( version: String , archivedBinaries: [ ArchivedBinary ] , releaseNoteInfo: ReleaseNoteInfo , path: String ) throws -> [ String ] {
7246 return try createReleaseWithAllBinaries ( version: version, archivedBinaries: archivedBinaries, releaseNoteInfo: releaseNoteInfo, path: path)
7347 }
7448
75- /// Verifies if the GitHub CLI (gh) is installed and provides installation instructions if not.
7649 public func ghVerification( ) throws {
7750 if try shell. bash ( " which gh " ) . contains ( " not found " ) {
7851 throw NnexError . missingGitHubCLI
0 commit comments