Skip to content

Commit

Permalink
Support Github Actions with Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
kyungminlee committed Nov 6, 2020
1 parent d1dfc39 commit ef53875
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/codecovio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,26 @@ module Codecov
build = ENV["BUILD_BUILDID"],
)
elseif haskey(ENV, "GITHUB_ACTION") # GitHub Actions
ref = ENV["GITHUB_REF"]
if startswith(ref, "refs/heads/")
branch = ref[12:end]
ga_pr = "false"
elseif startswith(ref, "refs/tags/")
branch = ref[11:end]
ga_pr = "false"
elseif startswith(ref, "refs/pull/")
branch = ENV["GITHUB_HEAD_REF"]
ga_pr = first(split(ref[11:end], "/"))
end
ga_build_url = "https://github.com/$(ENV["GITHUB_REPOSITORY"])/actions/runs/$(ENV["GITHUB_RUN_ID"])"
kwargs = set_defaults(kwargs,
service = "custom",
service = "github-actions",
branch = branch,
commit = ENV["GITHUB_SHA"],
pull_request = ga_pr,
slug = ENV["GITHUB_REPOSITORY"],
build = ENV["GITHUB_RUN_ID"],
build_url = ga_build_url,
)
else
error("No compatible CI platform detected")
Expand Down

0 comments on commit ef53875

Please sign in to comment.