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

Add optional 'conclusion' argument to emitTelemetry #62

Merged
merged 2 commits into from
Sep 16, 2022

Conversation

TooManyBees
Copy link
Contributor

This will allow the telemetry endpoint to receive the build job status directly in the request body, rather than needing to look it up.

@TooManyBees TooManyBees requested a review from a team as a code owner September 15, 2022 15:56
If present, will include the value of `conclusion` with the telemetry
POST body (gh/gh needs a separate PR to recognize this)
@TooManyBees TooManyBees force-pushed the pages/get-build-conclusion branch from a445abf to 1c52af2 Compare September 15, 2022 16:14
@@ -22,11 +22,12 @@ async function emitTelemetry() {
// All variables we need from the runtime are set in the Deployment constructor
const deployment = new Deployment()
const telemetryUrl = `${deployment.githubApiUrl}/repos/${deployment.repositoryNwo}/pages/telemetry`
core.info(`Sending telemetry for run id ${deployment.workflowRun}`)
const conclusion = core.getInput('conclusion') || null
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need the || null here? I thought that may be the implicit default with JavaScript. @JamesMGreene Would probably know better than me though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, it's because the empty string "" is falsy in javascript and truthy in ruby, so on the api side we want data["conclusion"] to have the correct truthiness (technically data["conclusion"].presence does this for us, but I wanted to be explicit).

Copy link
Contributor

Choose a reason for hiding this comment

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

undefined is the implicit default in JavaScript but core.getInput(...) in particular will return an empty string by default, so converting those into null values here makes sense to me. 👍🏻

Copy link
Collaborator

@yoannchaudet yoannchaudet left a comment

Choose a reason for hiding this comment

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

Looks good. My nit are not blockers.

@TooManyBees TooManyBees merged commit 44d4246 into main Sep 16, 2022
@TooManyBees TooManyBees deleted the pages/get-build-conclusion branch September 16, 2022 13:33
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