Skip to content

Commit

Permalink
Revert "Add ACTION_SWIFTLINT_SHA instead of overriding GITHUB_SHA"
Browse files Browse the repository at this point in the history
This reverts commit 2764da3.
  • Loading branch information
norio-nomura committed Sep 18, 2019
1 parent 2764da3 commit c6516d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: docker://norionomura/swiftlint:swift-5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTION_SWIFTLINT_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
with:
entrypoint: swift
args: test
Expand Down
14 changes: 6 additions & 8 deletions Sources/Lib/GitHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extension GitHub.Repository.CheckRun {

extension GitHub.Repository {
public func currentCheckRun() -> CheckRun? {
guard let sha = environment("ACTION_SWIFTLINT_SHA", "GITHUB_SHA") else { return nil }
guard let sha = environment("GITHUB_SHA") else { return nil }
guard let checkRun = findCheckRun(for: sha) else {
print("Current Action not found!")
return nil
Expand Down Expand Up @@ -204,12 +204,10 @@ extension GitHub.Repository {
}
}

private func environment(_ keys: String...) -> String? {
for key in keys {
if let value = ProcessInfo.processInfo.environment[key] {
return value
}
private func environment(_ key: String) -> String? {
guard let value = ProcessInfo.processInfo.environment[key] else {
print("Can not find `\(key)` environment variable.")
return nil
}
print("Can not find `\(keys)` environment variable.")
return nil
return value
}

0 comments on commit c6516d2

Please sign in to comment.