GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix `upload-sarif` Action failing if there are no Code Scanning SARIF files by mbg · Pull Request #3123 · github/codeql-action Conversation
|
| File | Description |
|---|---|
| upload-sarif/action.yml | Updates output descriptions and adds new sarif-ids output |
| src/upload-sarif-action.ts | Refactors upload logic with new findAndUpload function and combined status reporting |
| src/upload-lib.ts | Adds combineSarifUploadResults function to merge upload status reports |
| pr-checks/checks/upload-quality-sarif.yml | Updates test to use code-quality only and validates new output |
| lib/upload-sarif-action.js | Generated JavaScript code reflecting TypeScript changes |
| lib/upload-lib.js | Generated JavaScript code with new export for combine function |
| .github/workflows/__upload-quality-sarif.yml | Auto-generated workflow file updated for code-quality only testing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
00415e9 to
79b45c8
Compare
There was an error while loading. Please reload this page.
6d2c7db to
bca5bc4
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you motivate the Disable cpp in upload-quality-sarif check commit?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| await sendSuccessStatusReport(startedAt, uploadResult.statusReport, logger); | ||
| await sendSuccessStatusReport( | ||
| startedAt, | ||
| uploadResult?.statusReport || {}, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is it convention to add the empty object to these statuses by default?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Note that this was an intermediate commit and the {} just made the type checker happy until I replaced it with the statusReport from the Code Quality upload or the combination of both uploads.
The three properties of UploadStatusReport are all of type number | undefined, but the UploadStatusReport object itself is required here by sendSuccessStatusReport.
Previously, with only Code Scanning, we only would have reached sendSuccessStatusReport if the SARIF upload to Code Scanning is successful. In that case, the UploadStatusReport object always would have been populated.
Now we also have Code Quality and Code Scanning + Code Quality. So the status report should include the results of the respective upload(s).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| for (const report of reports) { | ||
| if (report !== undefined) { | ||
| result.num_results_in_sarif = addOptional( | ||
| result.num_results_in_sarif, | ||
| report.num_results_in_sarif, | ||
| ); | ||
| result.raw_upload_size_bytes = addOptional( | ||
| result.raw_upload_size_bytes, | ||
| report.raw_upload_size_bytes, | ||
| ); | ||
| result.zipped_upload_size_bytes = addOptional( | ||
| result.zipped_upload_size_bytes, | ||
| report.zipped_upload_size_bytes, | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is too ad hoc for my taste. Once we add a new numeric field to the type, it will get dropped when going through this function
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I.e. something like
for (const report of reports) {
if (!report) continue;
for (const key of Object.keys(report) as (keyof UploadStatusReport)[]) {
const value = report[key];
if (typeof value !== "number") continue; // Skip non-numeric / undefined
result[key] = ((result[key] ?? 0) as number) + value;
}
}
Conversely, we now risk adding things that can't be added...
Ultimately, we could do some typescript magic where we'd force ourselves to list every numerically typed property as being added or ignored, but that is complex.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We could do something like that. Perhaps it is best if we leave sorting out the telemetry for a separate change so that we can think about this independently from the bug fix -- see my thoughts in the PR description and in #3123 (comment)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@esbena C++ has no queries in the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it is best if we leave sorting out the telemetry for a separate change so that we can think about this independently from the bug fix
OK and conditional approve if we do that change elsewhere.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Unlike `sarif-id` which is for the single Code Scanning SARIF id, `sarif-ids` contains stringified JSON object with details of all SARIF ids.
bca5bc4 to
db37d92
Compare
|
I've removed the telemetry changes, other than that in the CQ-only case we send an empty |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.