How to override GITHUB_HEAD_REF value on github actions workflow

Trying to upload a saved coverage report from the PR as the master branch coverage inside PR merge github actions event

How could I disable github actions detection or override GITHUB_HEAD_REF value and set it as master branch?

Thank you all in advance for any help.

Using the bash uploader, you can specify -B master. You cannot override GITHUB_* env variables, but we will override the branch name.

Hey Tom, how are you, fine?

How could I turn github actions detection off in the bash uploader?

Even passing manually all the paremeters, bash upload still override them by detecting github actions environment:


Passing parameters

![Screen Shot 2021-08-10 at 16.47.37|685x500](upload://nmAseijxR6hBzHpA0HCMhNt21V5.jpeg)
==> GitHub Actions detected.
[33] Env vars used:
[34] -> GITHUB_ACTIONS: true
[35] -> GITHUB_HEAD_REF: feature-20773
[36] -> GITHUB_REF: master
[37] -> GITHUB_REPOSITORY: unimedrj/visitaweb
[38] -> GITHUB_RUN_ID: 1114320818
[39] -> GITHUB_SHA: 427389436351052024a44bcb1861d606021e36e0
[40] -> GITHUB_WORKFLOW: Release workflow

I want that this coverage report being detected as master report.

Thanks in advance.

GITHUB_HEAD_REF env var on github actions environment is overriding the -B parameter

@wagnerpereira, hmmm, can you share the full output? We shouldn’t be overriding, and the env vars is just data, not that we are not overriding.

What I’m looking for is the actual call the uploader makes branch=

=>
Run bash <(curl -s https://codecov.io/bash) -F unit -z coverage/coverage-unit-tests.xml \
  bash <(curl -s https://codecov.io/bash) -F unit -z coverage/coverage-unit-tests.xml \
    -P 100 -B master -C 4bf7448ca6cfee5a44750279bd5e40fd068eb09a \
    -T v0.1.71
  shell: /usr/bin/bash -e ***0***
  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.6

==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> GitHub Actions detected.
    Env vars used:
      -> GITHUB_ACTIONS:    true
      -> GITHUB_HEAD_REF:   feature-20773
      -> GITHUB_REF:        master
      -> GITHUB_REPOSITORY: unimedrj/visitaweb
      -> GITHUB_RUN_ID:     1114320818
      -> GITHUB_SHA:        427389436351052024a44bcb1861d606021e36e0
      -> GITHUB_WORKFLOW:   Release workflow
    current dir:  /home/runner/work/visitaweb/visitaweb
    project root: .
--> token set from env
    Yaml found at: .codecov.yml
    -> Found 1 reports
==> Gzipping contents
        12K	/tmp/codecov.Pb7S7X.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=master&commit=4bf7448ca6cfee5a44750279bd5e40fd068eb09a&build=1114320818&build_url=https%3A%2F%2Fgithub.com%2Funimedrj%2Fvisitaweb%2Factions%2Fruns%2F1114320818&name=&tag=v0.1.71&slug=unimedrj%2Fvisitaweb&service=github-actions&flags=unit&pr=100&job=Release%20workflow&cmd_args=F,z,P,B,C,T
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.6&token=<hidden>&package=bash-1.0.6&token=***&branch=master&commit=4bf7448ca6cfee5a44750279bd5e40fd068eb09a&build=1114320818&build_url=https%3A%2F%2Fgithub.com%2Funimedrj%2Fvisitaweb%2Factions%2Fruns%2F1114320818&name=&tag=v0.1.71&slug=unimedrj%2Fvisitaweb&service=github-actions&flags=unit&pr=100&job=Release%20workflow&cmd_args=F,z,P,B,C,T
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-08-09/44F8DF29C0C1895942CCD42E340E7BED/4bf7448ca6cfee5a44750279bd5e40fd068eb09a/badd491e-a2a6-4e34-b0b5-9f6e0ea3fd72.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EKKHVKCKHW7KBCGM7IHR55T63V2PAVJWLVFNITJHDU5G6R5IRN3LMWJA%2F20210809%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20210809T205948Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=4ae36d35dbcb98ce6f793e79aa912ed9a510357d3a807eb5da838d90dfa6aea1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  9095    0     0  100  9095      0  45934 --:--:-- --:--:-- --:--:-- 45703
100  9095    0     0  100  9095      0  45934 --:--:-- --:--:-- --:--:-- 45703
    -> Reports have been successfully queued for processing at https://codecov.io/github/unimedrj/visitaweb/commit/4bf7448ca6cfee5a44750279bd5e40fd068eb09a

Yes @tom, I think parameters a sended right .

Hey Tom, are you good?

No news for me?

@wagnerpereira I’m not sure I completely understand what the issue is. We are NOT overriding that value with GITHUB_HEAD_REF, are you seeing something else?

Hey @tom , the thing is that I can’t send coverage report for master branch passing the values you said in bash upload call. Even doing all that is in the documentation, Codecov dashboard shows the report was sent for the PR branch and not for master branch.

What I have to do to send my coverage report generated in the pull request github actions workflow to the master branch in codecov?

Thanks in advance.

@wagnerpereira let me make sure I’m getting this right. You are trying to send a saved coverage report from a PR run (on a commit on another branch) as the coverage for a commit on master (after that PR has been merged?). Do you not run coverage on the master branch?

I think you also need to override the pull value and to double-check, that the commit is also a commit on the master branch. To override the pull, you should use override_pr: 0

Hey @tom , it is exactly that. I need to send de PR coverage report as master coverage report after PR is squash merged in to the master branch. So, the head commit of the PR of the coverage report is diferent from the merge commit on the master.

Where I heve to set this “override_pr: 0”. ?

Thanks in advance.

@wagnerpereira ahhh apologies, I saw the wrong uploader. You can do -P 0. I would also strongly recommend using our new uploader as the bash uploader is getting deprecated.

Thanks @tom , I’ll test the new uploader with the pr parameter you said.

I’ll give feedback here.