File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -46,13 +46,16 @@ jobs:
4646 chmod +x codecov
4747 - name : Upload to codecov
4848 run : |
49- PR2=`gh pr view ${{ github.event.workflow_run.head_branch }} --json number -q .number`
50- echo $PR2
51- export PR=${{ github.event.workflow_run.pull_requests[0].number }}
52- export SHA=${{ github.event.workflow_run.head_sha }}
53- export VARARGS="-n github"
49+ # github does not reliably return the PR number for workflow_run. This workaround will get the PR (if a PR)
50+ if [ "${{ github.repository_owner }}" != "${OWNER}" ]; then BRANCH="${OWNER}:${BRANCH}"; fi
51+ if [ $(git branch --show-current) != $BRANCH ]; then PR=$(gh pr view $BRANCH --json number -q .number); fi
52+ echo uploading $BRANCH
53+ SHA=${{ github.event.workflow_run.head_sha }}
54+ VARARGS="-n github"
5455 # if a PR, pass proper information to codecov-cli about SHA, PR number
55- if [ -n "${PR}" ]; then export VARARGS="${VARARGS}-${PR}-${SHA} -P ${PR} -C ${SHA}"; fi
56+ if [ -n "${PR}" ]; then VARARGS="${VARARGS}-${PR}-${SHA} -P ${PR} -C ${SHA}"; fi
5657 ./codecov -v upload-process -Z -t ${{ secrets.CODECOV_TOKEN }} $VARARGS -F github -s ./coverage
5758 env :
5859 GH_TOKEN : ${{ github.token }}
60+ BRANCH : ${{ github.event.workflow_run.head_branch }}
61+ OWNER : ${{ github.event.workflow_run.head_repository.owner.name }}
You can’t perform that action at this time.
0 commit comments