fix: override commit and pr values for PR cases

This commit is contained in:
Tom Hu 2024-11-15 09:53:05 -05:00
parent 3b1354a6c4
commit 6c0ee7b7e8
No known key found for this signature in database
GPG key ID: 79155678363963D2
3 changed files with 25 additions and 4 deletions

View file

@ -1,5 +1,5 @@
deploy:
$(eval VERSION := $(shell cat src/version | grep 'CODECOV_ACTION_VERSION=' | cut -d\" -f2))
$(eval VERSION := $(shell cat src/version | grep 'CODECOV_ACTION_VERSION=' | cut -d\" -f2))
git tag -d v5
git push origin :v5
git tag v5

View file

@ -194,6 +194,27 @@ runs:
GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME: ${{ github.event.pull_request.repo.full_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Override commits and pr for pull requests
shell: bash
run: |
if [ -z "$CC_SHA" ];
then
CC_SHA="$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA"
fi
if [ -z "$CC_PR" ] && [ "${GITHUB_EVENT_NAME}" == "pull_request_target" ];
then
CC_PR="$GITHUB_EVENT_NUMBER"
fi
echo "CC_SHA=$CC_SHA" >> $GITHUB_ENV
echo "CC_PR=$CC_PR" >> $GITHUB_ENV
env:
CC_PR: ${{ inputs.override_pr }}
CC_SHA: ${{ inputs.override_commit }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
- name: Upload coverage to Codecov
run: ${GITHUB_ACTION_PATH}/dist/codecov.sh
shell: bash
@ -229,9 +250,9 @@ runs:
CC_OS: ${{ inputs.os }}
CC_PARENT_SHA: ${{ inputs.commit_parent }}
CC_PLUGINS: ${{ inputs.plugins }}
CC_PR: ${{ inputs.override_pr }}
CC_PR: $CC_PR
CC_REPORT_TYPE: ${{ inputs.report_type }}
CC_SHA: ${{ inputs.override_commit }}
CC_SHA: $CC_SHA
CC_SKIP_VALIDATION: ${{ inputs.skip_validation }}
CC_SLUG: ${{ inputs.slug }}
CC_SWIFT_PROJECT: ${{ inputs.swift_project }}

View file

@ -1 +1 @@
CODECOV_ACTION_VERSION="5.0.1"
CODECOV_ACTION_VERSION="5.0.2"