From 373fd71a645bc4bb6a527a2225d0db67206bf786 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:11:41 -0500 Subject: [PATCH] fix: update CODECOV_TOKEN and fix tokenless (#1688) * fix: add space * fix: update CODECOV_TOKEN if set with env --- action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b3ec2321f..c7298144b 100644 --- a/action.yml +++ b/action.yml @@ -173,6 +173,9 @@ runs: # {"count":1984,"value":"***"} CC_TOKEN=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://codecov.io" | cut -d\" -f6) echo "CC_TOKEN=$CC_TOKEN" >> "$GITHUB_ENV" + elif [ -n "${{ env.CODECOV_TOKEN }}" ]; + then + echo "CC_TOKEN=${{ env.CODECOV_TOKEN }}" >> "$GITHUB_ENV" else if [ -n ${{ inputs.token }} ]; then @@ -184,7 +187,7 @@ runs: - name: Override branch for forks shell: bash run: | - if [ -z "$CC_BRANCH" ] && [ -z "$CC_TOKEN" ] && [ -n "$GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME"] && [ "${GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME}" != "$GITHUB_REPOSITORY" ]; + if [ -z "$CC_BRANCH" ] && [ -z "$CC_TOKEN" ] && [ -n "$GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME" ] && [ "${GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME}" != "$GITHUB_REPOSITORY" ]; then echo -e "\033[0;32m==>\033[0m Fork detected, tokenless uploading used" TOKENLESS="$GITHUB_EVENT_PULL_REQUEST_HEAD_LABEL"