Skip to content

Commit

Permalink
[#498] Create Enum for gifhub runner type
Browse files Browse the repository at this point in the history
  • Loading branch information
ducbm051291 committed Dec 4, 2023
1 parent 622af2a commit c5d8da3
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ struct SetUpCICDService {
}
}
}

enum GithubRunnerType {

case macOSLatest, selfHosted

init?(_ name: String) {
switch name.lowercased() {
case "m", "macOS":
self = .macOSLatest
case "s", "self-hosted":
self = .selfHosted
default:
return nil
}
}
}

private let fileManager = FileManager.default

Expand All @@ -33,14 +49,10 @@ struct SetUpCICDService {

switch service {
case .github:
var runnerType: String?
var runnerType: GithubRunnerType?
while runnerType == nil {
print("Which workflow runner do you want to use? [(m)acos-latest/(s)elf-hosted]: ")
runnerType = readLine()?.lowercased()
if runnerType != "m" && runnerType != "s" {
print("Invalid input. Please enter 'm' for macOS-latest or 's' for self-hosted.")
runnerType = nil
}
runnerType = GithubRunnerType(readLine().string)
}
print("Setting template for Github Actions")
fileManager.removeItems(in: "bitrise.yml")
Expand Down

0 comments on commit c5d8da3

Please sign in to comment.