Skip to content
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

Send init-post status report in absence of config #2751

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

henrymercer
Copy link
Contributor

This PR fixes a bug in the init-post Action where we would not send a status report if the configuration was not available. This resulted in limited telemetry in cases where CodeQL was not initialized, for example if it could not be downloaded.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@Copilot Copilot bot review requested due to automatic review settings February 3, 2025 19:48
@henrymercer henrymercer requested a review from a team as a code owner February 3, 2025 19:48

Choose a reason for hiding this comment

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

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

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

Comment on lines +70 to 79
} else {
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct? I think this still doesn't send a status report if there's no config. Would this work?

Suggested change
} else {
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);
}
}
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's correct — the status report is sent later on in the file, but the original code was returning early so it was never sent.

The suggested change won't work because config is required to upload debug artifacts 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The return is the problem. We won't be able to upload a failed SARIF file if we don't have a config, because we need CodeQL to do that. But we should still upload a status report, and the status report code comes at the end of the runWrapper function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah...got it. I only reviewed the changed bits, so I missed what's happening later. LGTM.

Copy link
Contributor

@angelapwen angelapwen left a comment

Choose a reason for hiding this comment

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

Thanks for the find!!

@henrymercer henrymercer enabled auto-merge February 3, 2025 19:58
Comment on lines +70 to 79
} else {
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah...got it. I only reviewed the changed bits, so I missed what's happening later. LGTM.

@henrymercer henrymercer merged commit 08bc0cf into main Feb 3, 2025
275 of 276 checks passed
@henrymercer henrymercer deleted the henrymercer/fix-init-post-without-config branch February 3, 2025 20:00
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.

3 participants