Skip to content

Commit

Permalink
Command add github flag for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
yume190 committed Sep 7, 2023
1 parent f7fe002 commit c998ff7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Sources/LeakDetect/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ struct Command: AsyncParsableCommand {
@Option(name: [.customLong("reporter", withSingleDash: false)], help: "[\(Reporter.all)]")
var reporter: Reporter = .vscode

@Flag(name: [.customLong("github", withSingleDash: false), .short], help: "Is use github action")
var github: Bool = false

@Option(name: [.customLong("sdk", withSingleDash: false)], help: "[\(SDK.all)]")
var sdk: SDK = .iphonesimulator

Expand Down Expand Up @@ -90,15 +93,16 @@ struct Command: AsyncParsableCommand {

private func newReporter() -> (Reporter, GithubAtionReporter?) {
switch reporter {
case .xcode: fallthrough
case .vscode:
return (reporter, nil)
case .custom:
case .custom where github:
let githubAction = GithubAtionReporter(base: base)
let reporter = Reporter.custom { [weak githubAction] location, _ in
githubAction?.add(location)
}
return (reporter, githubAction)
case .xcode: fallthrough
case .vscode: fallthrough
case .custom :
return (reporter, nil)
}
}

Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:
run: |
# TEMP_DIR=$(mktemp -d)
curl -sSL \
"https://github.com/yume190/LeakDetect/releases/download/0.0.4.4/leakDetect" \
"https://github.com/yume190/LeakDetect/releases/download/0.0.5/leakDetect" \
-o leakDetect
chmod +x leakDetect
Expand All @@ -58,6 +58,7 @@ runs:
run: |
./leakDetect \
--reporter custom \
--github \
--sdk ${{inputs.sdk}} \
--file ${{inputs.file}}
Expand All @@ -72,5 +73,6 @@ runs:
run: |
./leakDetect \
--reporter custom \
--github \
--module ${{inputs.module}} \
--file ${{inputs.file}}

0 comments on commit c998ff7

Please sign in to comment.