mirror of
https://github.com/actions/deploy-pages.git
synced 2025-12-09 12:26:11 +00:00
Add optional 'conclusion' argument to emitTelemetry
If present, will include the value of `conclusion` with the telemetry POST body (gh/gh needs a separate PR to recognize this)
This commit is contained in:
@@ -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
|
||||
core.info(`Sending telemetry for run id ${deployment.workflowRun}: ${conclusion}`)
|
||||
await axios
|
||||
.post(
|
||||
telemetryUrl,
|
||||
{ github_run_id: deployment.workflowRun },
|
||||
{ github_run_id: deployment.workflowRun, conclusion },
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
|
||||
@@ -17,6 +17,7 @@ describe('emitTelemetry', () => {
|
||||
process.env.GITHUB_ACTOR = 'monalisa'
|
||||
process.env.GITHUB_ACTION = '__monalisa/octocat'
|
||||
process.env.GITHUB_ACTION_PATH = 'something'
|
||||
process.env.INPUT_CONCLUSION = 'success'
|
||||
|
||||
jest.spyOn(core, 'setOutput').mockImplementation(param => {
|
||||
return param
|
||||
@@ -47,7 +48,8 @@ describe('emitTelemetry', () => {
|
||||
expect(axios.post).toBeCalledWith(
|
||||
'https://api.github.com/repos/actions/is-awesome/pages/telemetry',
|
||||
{
|
||||
github_run_id: process.env.GITHUB_RUN_ID
|
||||
github_run_id: process.env.GITHUB_RUN_ID,
|
||||
conclusion: 'success'
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user