Skip to content

fix: prevent codecov upload from failing on forks#1752

Open
ParasSalonia wants to merge 4 commits intohiero-ledger:mainfrom
ParasSalonia:fix/codecov-fork-pr-token
Open

fix: prevent codecov upload from failing on forks#1752
ParasSalonia wants to merge 4 commits intohiero-ledger:mainfrom
ParasSalonia:fix/codecov-fork-pr-token

Conversation

@ParasSalonia
Copy link
Contributor

  • Fixes Codecov upload failures on forked pull requests by safely handling missing tokens.

Fixes #1485

Signed-off-by: ParasSalonia <parassalonia22@gmail.com>
@exploreriii
Copy link
Contributor

Hi @parvninama will this fail to run the check for PRs coming in from a fork?

@exploreriii exploreriii marked this pull request as ready for review February 8, 2026 17:10
@exploreriii exploreriii requested review from a team as code owners February 8, 2026 17:10
@exploreriii exploreriii added the status: needs triage review PR needs a review from the triage team label Feb 8, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Warning

Rate limit exceeded

@ParasSalonia has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Added a guard condition to the Codecov upload step in the GitHub workflow so the step only runs for the hiero-ledger repository and when the PR is not from a fork; added a changelog entry documenting the fix.

Changes

Cohort / File(s) Summary
Codecov Fork Guard
.github/workflows/pr-check-codecov.yml
Added if: github.repository_owner == 'hiero-ledger' && !github.event.pull_request.head.repo.fork to the "Upload coverage to Codecov" step to skip uploads for forked PRs or non-hiero-ledger repositories.
Changelog
CHANGELOG.md
Added entry noting the fork guard fix to prevent Codecov upload failures on forked PRs due to a missing token.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: prevent codecov upload from failing on forks' accurately describes the main change, which adds a guard condition to skip Codecov upload on forked PRs.
Description check ✅ Passed The description directly relates to the changeset by explaining that it fixes Codecov upload failures on forked pull requests and references the related issue #1485.
Linked Issues check ✅ Passed The PR implementation matches issue #1485 requirements: it adds the fork guard condition (github.repository_owner == 'hiero-ledger' && !github.event.pull_request.head.repo.fork) to skip Codecov upload on forks, includes a changelog entry, and addresses the acceptance criteria.
Out of Scope Changes check ✅ Passed All changes are in scope: the guard condition in the workflow file and the changelog entry directly address issue #1485 requirements with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pr-check-codecov.yml (1)

43-48: 🧹 Nitpick | 🔵 Trivial

Guard condition is correct; consider adding a visible skip notice.

The if condition correctly handles all three trigger scenarios:

  • push to main: pull_request context is null → !null is truthy → upload runs ✓
  • PR from main repo: fork is false → upload runs ✓
  • PR from fork: fork is true → upload skipped ✓

However, when the step is skipped, there's no log output indicating why. Per the coding guidelines (Priority 8), silent skips should be avoided. Consider adding an explicit step that logs when the upload is skipped:

Suggested addition before the upload step
+            - name: Skip Codecov upload (fork or external PR)
+              if: github.repository_owner != 'hiero-ledger' || github.event.pull_request.head.repo.fork
+              run: echo "::notice::Codecov upload skipped — not applicable for forks or external repositories."
+
             - name: Upload coverage to Codecov
               if: github.repository_owner == 'hiero-ledger' && !github.event.pull_request.head.repo.fork

As per coding guidelines, "Avoid: Silent success or silent skips".

ParasSalonia and others added 2 commits February 8, 2026 22:49
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Paras Salonia <parassalonia22@gmail.com>
@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

Quick Fix for CHANGELOG.md Conflicts

If your conflict is only in CHANGELOG.md, you can resolve it easily using the GitHub web editor:

  1. Click on the "Resolve conflicts" button in the PR
  2. Accept both changes (keep both changelog entries)
  3. Click "Mark as resolved"
  4. Commit the merge

For all other merge conflicts, please read:

Thank you for contributing!

Signed-off-by: Paras Salonia <parassalonia22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs triage review PR needs a review from the triage team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Beginner]: Codecov upload fails on fork PRs due to missing token

2 participants