Skip to content

Conversation

@dejan-lukic
Copy link
Contributor

@dejan-lukic dejan-lukic commented Jun 12, 2025

The qlty.sh api does not yield coverage results for references in the format refs/pull/{number}.

This PR instead retrieves the commit SHA for the currently viewed PR via the Changes from... element (see screenshot) on the page. Alternatively, we could (and probably should) use a more robust method to retrieve the SHA, e.g. via the GitHub API

Screenshot 2025-06-13 at 9 57 59 am

Copilot AI review requested due to automatic review settings June 12, 2025 06:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances reference resolution by first attempting to extract the current pull request’s commit SHA from the page’s details-menu and falling back to URL-based refs, and updates the coverage loader to use the new reference parameter.

  • Introduce getRef, getPullRequestCommitSha, and getRefFromUrl to resolve the correct Git reference
  • Update loadCoverageForPath to pass the resolved ref into readCoverageData
  • Change readCoverageData signature to accept an explicit reference and remove inline URL parsing

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/github.ts Add commit SHA extraction, URL fallback logic, and ref lookup
src/api.ts Update readCoverageData to take a reference parameter
Comments suppressed due to low confidence (1)

src/github.ts:13

  • [nitpick] Add unit tests for the new getRef, getPullRequestCommitSha, and getRefFromUrl functions to verify correct behavior across different page states (e.g., PR view, commit view, and non-PR pages).
function getRef() {

@dejan-lukic dejan-lukic force-pushed the feature/get-correct-ref-for-pull-requests branch from 27946e3 to 9175d65 Compare June 12, 2025 23:53
@dejan-lukic dejan-lukic force-pushed the feature/get-correct-ref-for-pull-requests branch from 9175d65 to a125502 Compare June 28, 2025 02:11
@CLAassistant
Copy link

CLAassistant commented Jul 1, 2025

CLA assistant check
All committers have signed the CLA.

@dejan-lukic dejan-lukic force-pushed the feature/get-correct-ref-for-pull-requests branch from a125502 to a47ba72 Compare July 1, 2025 23:34
…ts, as refs/pull/{number} does not yield results from the qlty.sh API
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.

2 participants