diff --git a/src/codecovio.jl b/src/codecovio.jl index 4b18986..7d2c1fc 100644 --- a/src/codecovio.jl +++ b/src/codecovio.jl @@ -139,6 +139,7 @@ module Codecov build = ENV["BUILD_BUILDID"], ) elseif haskey(ENV, "GITHUB_ACTION") # GitHub Actions + event_path = open(JSON.Parser.parse, ENV["GITHUB_EVENT_PATH"]) ref = ENV["GITHUB_REF"] if startswith(ref, "refs/heads/") branch = ref[12:end] @@ -148,7 +149,8 @@ module Codecov ga_pr = "false" elseif startswith(ref, "refs/pull/") branch = ENV["GITHUB_HEAD_REF"] - ga_pr = first(split(ref[11:end], "/")) + ga_pr_info = get(event_path, "pull_request", Dict()) + ga_pr = get(ga_pr_info, "number", "false") end ga_build_url = "https://github.com/$(ENV["GITHUB_REPOSITORY"])/actions/runs/$(ENV["GITHUB_RUN_ID"])" kwargs = set_defaults(kwargs, diff --git a/src/coveralls.jl b/src/coveralls.jl index 5150769..6401061 100644 --- a/src/coveralls.jl +++ b/src/coveralls.jl @@ -102,8 +102,14 @@ module Coveralls data["git"]["branch"] = split(ENV["GIT_BRANCH"], "/")[2] end elseif haskey(ENV, "GITHUB_ACTION") + data["service_job_id"] = ENV["GITHUB_RUN_ID"] data["service_name"] = "github" data["git"] = parse_git_info(git_info) + + event_path = open(JSON.Parser.parse, ENV["GITHUB_EVENT_PATH"]) + github_pr_info = get(event_path, "pull_request", Dict()) + github_pr = get(github_pr_info, "number", "") + isempty(github_pr) || (data["service_pull_request"] = github_pr) else data["git"] = parse_git_info(git_info) end