Compare commits

...
Author SHA1 Message Date
Blake FriedmanandFacebook GitHub Bot f99108e161 Log out which workflow artifact we're using (#48046)
Summary:
Make it clearer to the release crew to avoid using an outdated artifact
for testing a release.

{F1971030533}

Changelog: [Internal]


Test Plan:
```
yarn test-e2e-local -t "RNTester" -p "Android" -h true -c $GITHUB_TOKEN
```

Reviewed By: robhogan

Differential Revision: D66657082

Pulled By: blakef
2024-12-02 09:52:34 -08:00
@@ -11,6 +11,7 @@
'use strict';
const chalk = require('chalk');
const {execSync: exec} = require('child_process');
const fetch = require('node-fetch');
@@ -30,6 +31,18 @@ type WorkflowRun = {
url: string,
created_at: string,
conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null,
head_commit: {
author: {
name: string,
},
message: string,
...
};
triggering_actor: {
login: string,
...
};
run_started_at: string,
};
@@ -102,6 +115,13 @@ async function _getArtifacts(run_id /*: number */) /*: Promise<Artifacts> */ {
return body;
}
function quote(text /*: string*/, prefix /*: string */ = ' > ') {
return text
.split('\n')
.map(line => prefix + line)
.join('\n');
}
// === Public Interface === //
async function initialize(
ciToken /*: string */,
@@ -149,6 +169,21 @@ async function initialize(
) ?? workflow;
}
const commit = workflow.head_commit;
const hours =
(new Date().getTime() - new Date(workflow.run_started_at).getTime()) /
(60 * 60 * 1000);
const started_by = workflow.triggering_actor.login;
console.log(
chalk.green(`The artifact being used is from a workflow started ${chalk.bold.magentaBright(hours.toFixed(0))} hours ago by ${chalk.bold.magentaBright(started_by)}:
Author: ${chalk.bold(commit.author.name)}
Message:
${chalk.magentaBright(quote(commit.message))}
`),
);
artifacts = await _getArtifacts(workflow.id);
}