-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Grab compare SHA for GH pre-merge commits #147
feat: Grab compare SHA for GH pre-merge commits #147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the largest issue is the consistent usage of debug mode throughout the code. Additionally, the use of the compareSHA is unclear and potentially not working as expected. Testing coverage for the added functional code appears robust.
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodecovAI submitted a new review for c5d9902
@@ -22,12 +22,12 @@ jobs: | |||
fetch-depth: 0 | |||
|
|||
- name: Setup node | |||
uses: actions/setup-node@v3 | |||
uses: actions/setup-node@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The node setup action version was upgraded from v3 to v4. Compatibility for all related plugins and actions with the newer version should be ensured.
with: | ||
node-version: 20 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
uses: pnpm/action-setup@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm setup action version was upgraded from v2 to v4. Make sure this plugin's functionalities are unbroken by this change.
with: | ||
node-version: 20 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HEAD_SHA and BASE_SHA were added as environment variables. Make sure they are being declared and correctly manipulated in the context.
@@ -22,6 +22,11 @@ export default defineConfig({ | |||
bundleName: "@codecov/example-rollup-app", | |||
apiUrl: process.env.ROLLUP_API_URL, | |||
uploadToken: process.env.ROLLUP_UPLOAD_TOKEN, | |||
debug: true, | |||
uploadOverrides: { | |||
sha: process.env.HEAD_SHA, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding an uploadOverrides object with 'sha'/'compareSha' properties. Make sure this doesn't overlap or cause conflicts with existing functionality, and that the values are being correctly provided from the environment.
@@ -10,6 +10,11 @@ | |||
body[key] = encodeSlug(value); | |||
} | |||
|
|||
// temporary removal for testing | |||
if (key === "compareSha") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'compareSha' key is being temporarily removed for testing. If this code is intended for production, this deletion should not occur here.
@@ -158,6 +158,43 @@ | |||
return commit ?? ""; | |||
} | |||
|
|||
function _getCompareSHA(inputs: ProviderUtilInputs, output: Output): string { | |||
const { args } = inputs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_getCompareSHA function is added. The complexity of the function could potentially be a point of failure, ensure it is adequately tested and performs as expected in various scenarios.
Bundle ReportChanges will increase total bundle size by 533.98kB ⬆️
|
Bundle ReportChanges will increase total bundle size by 968.29kB ⬆️
|
|
||
debug(`Using compareSha: ${compareSha ?? ""}`, { enabled: output.debug }); | ||
|
||
return compareSha ?? ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we return null
or undefined
if compareSha
is not set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a left-over style from the original Codecov Node uploader, tho we should probably adjust this. We do have a guard in the preProcessBody
that does handle this for us. Tho we should probably update this overall to just return null
.
Description
This PR updates the GitHubAction provider to grab the correct "compare SHA" for GH PRs and send it along to the API. This value has also been added to the upload override options so the user can override the value in their bundler config if they wish to do so.
Notable Changes
compareSha
tonormalizeOptions
GitHubActions
provider utilsdebug
set totrue