Skip to content

ci: pass CODECOV_TOKEN explicitly to codecov-action#21

Merged
maltsev-dev merged 1 commit into
masterfrom
ci/explicit-codecov-token
Jun 19, 2026
Merged

ci: pass CODECOV_TOKEN explicitly to codecov-action#21
maltsev-dev merged 1 commit into
masterfrom
ci/explicit-codecov-token

Conversation

@maltsev-dev

Copy link
Copy Markdown
Member

Problem

Previous CI runs #27811830168 and #27812924596 both completed but Codecov upload failed with:

warning - Branch `<X>` is protected but no token was provided
error - Commit creating failed: {"message":"Token required because branch is protected"}
error - Report creating failed: {"message":"Token required because branch is protected"}
error - Upload queued for processing failed: {"message":"Token required because branch is protected"}

The CODECOV_TOKEN secret IS configured in repo settings (gh secret list shows it), but codecov-action@v4 is not picking it up from env in this workflow.

Fix

Pass the token explicitly via the action's token input. Also pin the report file path and disable hard-fail on upload error so a Codecov outage doesn't block CI.

       - uses: codecov/codecov-action@v4
-        if: always()
+        if: always()
+        with:
+          token: ${{ secrets.CODECOV_TOKEN }}
+          files: ./coverage.xml
+          fail_ci_if_error: false

Verification

After merge, the next CI run should:

codecov-action@v4 was not picking up CODECOV_TOKEN from env
automatically in this workflow (log shows 'no token was provided'
even though the secret is configured in repo settings). Pass it
explicitly via the token input to make uploads reliable.

Also add:
- files: ./coverage.xml - explicit report path
- fail_ci_if_error: false - coverage upload failures shouldn't
  break the CI run
@maltsev-dev maltsev-dev merged commit a3a72c0 into master Jun 19, 2026
0 of 4 checks passed
@maltsev-dev maltsev-dev deleted the ci/explicit-codecov-token branch June 19, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant