Skip to content

ci: fix the bug of No open pull request found#53

Merged
317787106 merged 1 commit into317787106:developfrom
0xbigapple:hotfix/ci_2
Mar 20, 2026
Merged

ci: fix the bug of No open pull request found#53
317787106 merged 1 commit into317787106:developfrom
0xbigapple:hotfix/ci_2

Conversation

@317787106
Copy link
Copy Markdown
Owner

@317787106 317787106 commented Mar 20, 2026

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details


Summary by cubic

Fixes the coverage upload workflow to find the pull request by commit SHA, preventing false “No open pull request found” failures and restoring reliable Codecov uploads.

  • Bug Fixes
    • Use github.rest.repos.listPullRequestsAssociatedWithCommit with commit_sha instead of github.rest.pulls.list filtered by head.
    • Works for merged/closed PRs and forked branches, not just open PRs.
    • Updated failure message to “No pull request found for commit ”.

Written for commit 639e64c. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

  • Chores
    • Improved pull request detection in the CI/CD pipeline's coverage upload workflow.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

The workflow's PR lookup step was refactored to retrieve pull request details using a commit SHA-based API query instead of filtering by repository owner and branch. The corresponding error message was updated to reflect this change.

Changes

Cohort / File(s) Summary
Workflow PR Lookup
.github/workflows/coverage-upload.yml
Modified the "Get PR details" step to use listPullRequestsAssociatedWithCommit API call with commit SHA instead of pulls.list filtered by owner and branch. Updated failure message accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A commit SHA lights the way,
No more branch names to betray,
The workflow hops to find its PR,
Direct as a rabbit beneath the star! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: fix the bug of No open pull request found' accurately describes the main change in the PR, which fixes a bug in the GitHub Actions workflow where the PR lookup mechanism was improved.
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
📝 Coding Plan
  • Generate coding plan for human review comments

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

Copy link
Copy Markdown

@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.

Caution

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

⚠️ Outside diff range comments (1)
.github/workflows/coverage-upload.yml (1)

45-56: ⚠️ Potential issue | 🔴 Critical

headBranch is undefined and will crash this step.

On line 55, headBranch is used but never declared in the script. This causes a ReferenceError at runtime and prevents PR outputs from being set, blocking the Codecov upload.

Proposed fix
             const headSha = context.payload.workflow_run.head_sha;
+            const headBranch = context.payload.workflow_run.head_branch;
             const { data: pulls } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
               owner: context.repo.owner,
               repo: context.repo.repo,
               commit_sha: headSha,
             });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage-upload.yml around lines 45 - 56, The script uses
headBranch when setting outputs but headBranch is never defined; replace its
usage by deriving the branch from the PR object (use pr.head.ref) or define
headBranch before use (e.g., const headBranch = pr.head.ref) so
core.setOutput('pr_branch', ...) uses a valid string; update the block that
handles pulls[0] (the pr variable) and the core.setOutput calls to reference
pr.head.ref (or the new headBranch) to avoid the ReferenceError.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/coverage-upload.yml:
- Around line 45-56: The script uses headBranch when setting outputs but
headBranch is never defined; replace its usage by deriving the branch from the
PR object (use pr.head.ref) or define headBranch before use (e.g., const
headBranch = pr.head.ref) so core.setOutput('pr_branch', ...) uses a valid
string; update the block that handles pulls[0] (the pr variable) and the
core.setOutput calls to reference pr.head.ref (or the new headBranch) to avoid
the ReferenceError.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2ab40438-d22e-4809-8c95-bdbe2af24fb1

📥 Commits

Reviewing files that changed from the base of the PR and between d3e1beb and 639e64c.

📒 Files selected for processing (1)
  • .github/workflows/coverage-upload.yml

@317787106 317787106 merged commit eab7a0b into 317787106:develop Mar 20, 2026
21 of 23 checks passed
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