Skip to content

Commit

Permalink
Update codecov.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
icfaust authored Dec 13, 2024
1 parent 624f1cf commit fa60674
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
upload_coverage:
name: Codecov
Expand All @@ -50,9 +46,18 @@ jobs:
chmod +x codecov
- name: Upload to codecov
run: |
export PR=${{ github.event.workflow_run.pull_requests[0].number }}
export SHA=${{ github.event.workflow_run.head_sha }}
export VARARGS="-n github"
# if a PR, pass proper information to codecov about SHA and PR, otherwise use main branch info
if [ -n "${PR}" ]; then export VARARGS="${VARARGS}-${PR}-${SHA} -P ${PR} -C ${SHA}"; fi
# github's webhooks for workflow_run are unreliable, this guarantees to pull the PR number if a PR
OWNER="${FULL_NAME%/$NAME}"
if [ "${{ github.repository_owner }}" != "${OWNER}" ]; then BRANCH="${OWNER}:${BRANCH}"; fi
if [ $(git branch --show-current) != $BRANCH ]; then PR=$(gh pr view $BRANCH --json number -q .number); fi
echo uploading $BRANCH
SHA=${{ github.event.workflow_run.head_sha }}
VARARGS="-C ${SHA} -n github-${SHA}"
# if a PR, pass proper information to codecov-cli about the PR number
if [ -n "${PR}" ]; then VARARGS="${VARARGS}-${PR} -P ${PR}"; fi
./codecov -v upload-process -Z -t ${{ secrets.CODECOV_TOKEN }} $VARARGS -F github -s ./coverage
env:
GH_TOKEN: ${{ github.token }}
BRANCH: ${{ github.event.workflow_run.head_branch }}
NAME: ${{ github.event.workflow_run.head_repository.name }}
FULL_NAME: ${{ github.event.workflow_run.head_repository.full_name }}

0 comments on commit fa60674

Please sign in to comment.