From 397ada75dd48f303d85d7d0f08442257c1cbff05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 18 Jun 2024 12:48:58 +0200 Subject: [PATCH 01/27] feat: script for getting uploaded sourcemaps --- package.json | 1 + scripts/release-profile.ts | 16 +- scripts/symbolicate-profile.ts | 216 ++++++++++++++++++ scripts/utils/Logger.ts | 38 +++ scripts/utils/parseCommandLineArguments.ts | 14 ++ .../BaseProfilingToolMenu.tsx | 1 + 6 files changed, 271 insertions(+), 15 deletions(-) create mode 100755 scripts/symbolicate-profile.ts create mode 100644 scripts/utils/Logger.ts create mode 100644 scripts/utils/parseCommandLineArguments.ts diff --git a/package.json b/package.json index e225ac67cb30..73f9fdc56195 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "symbolicate:ios": "npx metro-symbolicate main.jsbundle.map", "symbolicate-release:ios": "scripts/release-profile.ts --platform=ios", "symbolicate-release:android": "scripts/release-profile.ts --platform=android", + "symbolicate-profile": "scripts/symbolicate-profile.ts", "test:e2e": "ts-node tests/e2e/testRunner.ts --config ./config.local.ts", "test:e2e:dev": "ts-node tests/e2e/testRunner.ts --config ./config.dev.ts", "gh-actions-unused-styles": "./.github/scripts/findUnusedKeys.sh", diff --git a/scripts/release-profile.ts b/scripts/release-profile.ts index 8ec0979f9f9e..cfc7e2cb8838 100755 --- a/scripts/release-profile.ts +++ b/scripts/release-profile.ts @@ -3,21 +3,7 @@ /* eslint-disable no-console */ import {execSync} from 'child_process'; import fs from 'fs'; - -type ArgsMap = Record; - -// Function to parse command-line arguments into a key-value object -function parseCommandLineArguments(): ArgsMap { - const args = process.argv.slice(2); // Skip node and script paths - const argsMap: ArgsMap = {}; - args.forEach((arg) => { - const [key, value] = arg.split('='); - if (key.startsWith('--')) { - argsMap[key.substring(2)] = value; - } - }); - return argsMap; -} +import parseCommandLineArguments from './utils/parseCommandLineArguments'; // Function to find .cpuprofile files in the current directory function findCpuProfileFiles() { diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts new file mode 100755 index 000000000000..51396c0fc8ca --- /dev/null +++ b/scripts/symbolicate-profile.ts @@ -0,0 +1,216 @@ +#!/usr/bin/env ts-node + +/* eslint-disable @typescript-eslint/naming-convention */ + +/** + * This script helps to symbolicate a .cpuprofile file that was obtained from a specific (staging) app version (usually provided by a user using the app). + * + * @abstract + * + * 1. When creating a new deployment in our github actions, we upload the source map for android and iOS as artifacts. + * 2. The profiles created by the app on the user's device have the app version encoded in the filename. + * 3. This script takes in a .cpuprofile file, reads the app version from the filename, and downloads the corresponding source map from the artifacts. + * 4. It then uses the source map to symbolicate the .cpuprofile file using the `react-native-release-profiler` cli. + */ +import {Octokit} from '@octokit/core'; +import fs from 'fs'; +import https from 'https'; +import {platform} from 'os'; +import path from 'path'; +import * as Logger from './utils/Logger'; +import parseCommandLineArguments from './utils/parseCommandLineArguments'; + +const argsMap = parseCommandLineArguments(); + +// #region Input validation +if (Object.keys(argsMap).length === 0 || argsMap.help !== undefined) { + Logger.log('Symbolicates a .cpuprofile file obtained from a specific app version.'); + Logger.log('Usage: npm run symbolicate-profile -- --profile= --platform='); + Logger.log('Options:'); + Logger.log(' --profile= The .cpuprofile file to symbolicate'); + Logger.log(' --platform= The platform for which the source map was uploaded'); + Logger.log(' --gh-token Optional token to use for requests send to the GitHub API'); + Logger.log(' --help Display this help message'); + process.exit(0); +} + +if (argsMap.profile === undefined) { + Logger.error('Please specify the .cpuprofile file to symbolicate using --profile='); + process.exit(1); +} +if (!fs.existsSync(argsMap.profile)) { + Logger.error(`File ${argsMap.profile} does not exist.`); + process.exit(1); +} + +if (argsMap.platform === undefined) { + Logger.error('Please specify the platform using --platform=ios or --platform=android'); + process.exit(1); +} +// #endregion + +// #region Get the app version + +// Formatted as "Profile_trace_for_1.4.81-9.cpuprofile" +const appVersionRegex = /\d+\.\d+\.\d+(-\d+)?/; +const appVersion = argsMap.profile.match(appVersionRegex)?.[0]; +if (appVersion === undefined) { + Logger.error('Could not extract the app version from the profile filename.'); + process.exit(1); +} +Logger.info(`Found app version ${appVersion} in the profile filename`); +// #endregion + +// #region Utility functions +// The token is optional. GitHub allows public requests, but its heavily rate-limited. +// During development or when running this script a lot it can be useful to provide a token. +const octokit = new Octokit({auth: argsMap.ghToken}); +const OWNER = 'Expensify'; +const REPO = 'App'; + +function getWorkflowId() { + // Step 1: Find the workflow id + // Note: we could hard code it, but this way its simpler if the job changes in the future + const workflowFile = '.github/workflows/platformDeploy.yml'; + Logger.info(`Fetching workflow id for the source map job from ${workflowFile}`); + + return octokit + .request('GET /repos/{owner}/{repo}/actions/workflows', { + owner: OWNER, + repo: REPO, + per_page: 100, + }) + .then((workflowsResponse) => { + const workflow = workflowsResponse.data.workflows.find(({path}) => path === workflowFile); + if (workflow === undefined) { + throw new Error(`Could not find the workflow file ${workflowFile} in results! Has it been renamed?`); + } + return workflow.id; + }) + .catch((error) => { + Logger.error('Failed to fetch workflows to get the id for the source map job'); + Logger.error(error); + throw error; + }); +} + +function getWorkflowRun(workflowId: number) { + Logger.info(`Fetching workflow runs for workflow id ${workflowId} for branch ${appVersion}`); + return octokit + .request('GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs', { + owner: OWNER, + repo: REPO, + workflow_id: workflowId, + // For each app version a new branch is created, so we can filter by branch. + branch: appVersion, + // There should only be one successful deploy job for a given app version + per_page: 1, + // Note: the workflow run could fail for different jobs. If its completed its possible the sourcemaps have been uploaded. + // If the source map is not present, we will fail on the next step. + status: 'completed', + }) + .then((runsResponse) => { + if (runsResponse.data.total_count === 0) { + throw new Error(`No successful runs found for the app version ${appVersion}!\nAre you sure the job the upload source map job run successfully?`); + } + + const run = runsResponse.data.workflow_runs[0]; + if (run.status !== 'success') { + Logger.warn(`The run ${Logger.formatLink(run.id, run.html_url)} was not successful. The source map _might_ not be uploaded.`); + } else { + Logger.success(`Found successful run ${Logger.formatLink(run.id, run.html_url)} for app version ${appVersion}`); + } + + return run.id; + }) + .catch((error) => { + Logger.error('Failed to fetch workflow runs for the app version'); + Logger.error(error); + throw error; + }); +} + +function getWorkflowRunArtifact(runId: number, platform: 'ios' | 'android') { + const artefactName = `${platform}-sourcemap`; + Logger.info(`Fetching sourcemap artifact for run id ${runId} with name "${artefactName}"`); + return octokit + .request('GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts', { + owner: OWNER, + repo: REPO, + run_id: runId, + name: artefactName, + }) + .then((artifactsResponse) => { + const artifact = artifactsResponse.data.artifacts.find(({name}) => name === artefactName); + if (artifact === undefined) { + throw new Error(`Could not find the artifact ${artefactName} in results!`); + } + return artifact.id; + }) + .catch((error) => { + Logger.error('Failed to get artifact!'); + Logger.error(error); + throw error; + }); +} + +function getDownloadUrl(artifactId: number) { + // https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact + // Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. + // Look for Location: in the response header to find the URL for the download. + + Logger.log(`Getting download URL for artifact…`); + return octokit + .request('GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}', { + owner: OWNER, + repo: REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => { + // The response should be a redirect to the actual download URL + const downloadUrl = response.headers.location; + + if (downloadUrl === undefined) { + throw new Error('Could not find the download URL in the response headers!'); + } + + return downloadUrl; + }) + .catch((error) => { + Logger.error('Failed to download artifact!'); + Logger.error(error); + throw error; + }); +} + +function downloadFile(url: string) { + Logger.log(`Downloading file from URL: ${url}`); + + const destination = path.join(process.cwd(), `${argsMap.platform}-sourcemap.zip`); + const file = fs.createWriteStream(destination); + return new Promise((resolve, reject) => { + https + .get(url, (response) => { + response.pipe(file); + file.on('finish', () => { + file.close(); + Logger.success(`Downloaded file to ${destination}`); + resolve(destination); + }); + }) + .on('error', (error) => { + fs.unlink(destination, () => { + reject(error); + }); + }); + }); +} + +// #endregion + +getWorkflowId() + .then((workflowId) => getWorkflowRun(workflowId)) + .then((runId) => getWorkflowRunArtifact(runId, argsMap.platform as 'ios' | 'android')) + .then((artifactId) => getDownloadUrl(artifactId)) + .then((downloadUrl) => {}); diff --git a/scripts/utils/Logger.ts b/scripts/utils/Logger.ts new file mode 100644 index 000000000000..9cd04ba2b6b9 --- /dev/null +++ b/scripts/utils/Logger.ts @@ -0,0 +1,38 @@ +const COLOR_DIM = '\x1b[2m'; +const COLOR_RESET = '\x1b[0m'; +const COLOR_YELLOW = '\x1b[33m'; +const COLOR_RED = '\x1b[31m'; +const COLOR_GREEN = '\x1b[32m'; + + +const log = (...args: unknown[]) => { + console.debug(...args); +}; + +const info = (...args: unknown[]) => { + log('▶️', ...args); +}; + +const success = (...args: unknown[]) => { + const lines = ['✅', COLOR_GREEN, ...args, COLOR_RESET]; + log(...lines); +}; + +const warn = (...args: unknown[]) => { + const lines = ['⚠️', COLOR_YELLOW, ...args, COLOR_RESET]; + log(...lines); +}; + +const note = (...args: unknown[]) => { + const lines = [COLOR_DIM, ...args, COLOR_RESET]; + log(...lines); +}; + +const error = (...args: unknown[]) => { + const lines = ['🔴', COLOR_RED, ...args, COLOR_RESET]; + log(...lines); +}; + +const formatLink = (name: string | number, url: string) => `\x1b]8;;${url}\x1b\\${name}\x1b]8;;\x1b\\` + +export {log, info, warn, note, error, success, formatLink}; \ No newline at end of file diff --git a/scripts/utils/parseCommandLineArguments.ts b/scripts/utils/parseCommandLineArguments.ts new file mode 100644 index 000000000000..c33c07972b01 --- /dev/null +++ b/scripts/utils/parseCommandLineArguments.ts @@ -0,0 +1,14 @@ +type ArgsMap = Record; + +// Function to parse command-line arguments into a key-value object +export default function parseCommandLineArguments(): ArgsMap { + const args = process.argv.slice(2); // Skip node and script paths + const argsMap: ArgsMap = {}; + args.forEach((arg) => { + const [key, value] = arg.split('='); + if (key.startsWith('--')) { + argsMap[key.substring(2)] = value; + } + }); + return argsMap; +} diff --git a/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx b/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx index 6ab1761fda62..7fd1cdc4b14e 100644 --- a/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx +++ b/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx @@ -44,6 +44,7 @@ function formatBytes(bytes: number, decimals = 2) { return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`; } +// NOTE: When changing this name make sure that the "scripts/symbolicate-profile.ts" script is still working! const newFileName = `Profile_trace_for_${pkg.version}.cpuprofile`; function BaseProfilingToolMenu({isProfilingInProgress = false, pathToBeUsed, displayPath}: BaseProfilingToolMenuProps) { From 639d89be53c2a46640c0a710bdab985290b88e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 18 Jun 2024 15:27:12 +0200 Subject: [PATCH 02/27] finish implementation of download source map step --- .gitignore | 3 ++ scripts/symbolicate-profile.ts | 72 ++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index dcbec8a96e46..af58eaf0ad6c 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,6 @@ config/webpack/*.pem .expo dist/ web-build/ + +# Storage location for downloaded app source maps (see scripts/symbolicate-profile.ts) +.sourcemaps/ \ No newline at end of file diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 51396c0fc8ca..401a8f744695 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -13,9 +13,9 @@ * 4. It then uses the source map to symbolicate the .cpuprofile file using the `react-native-release-profiler` cli. */ import {Octokit} from '@octokit/core'; +import {execSync} from 'child_process'; import fs from 'fs'; import https from 'https'; -import {platform} from 'os'; import path from 'path'; import * as Logger from './utils/Logger'; import parseCommandLineArguments from './utils/parseCommandLineArguments'; @@ -29,7 +29,7 @@ if (Object.keys(argsMap).length === 0 || argsMap.help !== undefined) { Logger.log('Options:'); Logger.log(' --profile= The .cpuprofile file to symbolicate'); Logger.log(' --platform= The platform for which the source map was uploaded'); - Logger.log(' --gh-token Optional token to use for requests send to the GitHub API'); + Logger.log(' --gh-token Token to use for requests send to the GitHub API. By default tries to pick up from the environment variable GITHUB_TOKEN'); Logger.log(' --help Display this help message'); process.exit(0); } @@ -47,6 +47,12 @@ if (argsMap.platform === undefined) { Logger.error('Please specify the platform using --platform=ios or --platform=android'); process.exit(1); } + +const githubToken = argsMap.ghToken ?? process.env.GITHUB_TOKEN; +if (githubToken === undefined) { + Logger.error('No GitHub token provided. Either set a GITHUB_TOKEN environment variable or pass it using --gh-token'); + process.exit(1); +} // #endregion // #region Get the app version @@ -62,9 +68,8 @@ Logger.info(`Found app version ${appVersion} in the profile filename`); // #endregion // #region Utility functions -// The token is optional. GitHub allows public requests, but its heavily rate-limited. -// During development or when running this script a lot it can be useful to provide a token. -const octokit = new Octokit({auth: argsMap.ghToken}); +// We need the token for the download step +const octokit = new Octokit({auth: githubToken}); const OWNER = 'Expensify'; const REPO = 'App'; @@ -169,10 +174,10 @@ function getDownloadUrl(artifactId: number) { }) .then((response) => { // The response should be a redirect to the actual download URL - const downloadUrl = response.headers.location; + const downloadUrl = response.url; if (downloadUrl === undefined) { - throw new Error('Could not find the download URL in the response headers!'); + throw new Error(`Could not find the download URL in:\n${JSON.stringify(response, null, 2)}`); } return downloadUrl; @@ -184,10 +189,17 @@ function getDownloadUrl(artifactId: number) { }); } +const dirName = '.sourcemaps'; +const sourcemapDir = path.join(process.cwd(), dirName); + function downloadFile(url: string) { Logger.log(`Downloading file from URL: ${url}`); + if (!fs.existsSync(sourcemapDir)) { + Logger.info(`Creating download directory ${sourcemapDir}`); + fs.mkdirSync(sourcemapDir); + } - const destination = path.join(process.cwd(), `${argsMap.platform}-sourcemap.zip`); + const destination = path.join(sourcemapDir, `${argsMap.platform}-${appVersion}-sourcemap.zip`); const file = fs.createWriteStream(destination); return new Promise((resolve, reject) => { https @@ -207,10 +219,44 @@ function downloadFile(url: string) { }); } +function unpackZipFile(zipPath: string) { + Logger.info(`Unpacking file ${zipPath}`); + const command = `unzip -o ${zipPath} -d ${sourcemapDir}`; + execSync(command, {stdio: 'inherit'}); + Logger.info(`Deleting zip file ${zipPath}`); + return new Promise((resolve, reject) => { + fs.unlink(zipPath, (error) => (error ? reject(error) : resolve())); + }); +} + +const localSourceMapPath = path.join(sourcemapDir, `${appVersion}-${argsMap.platform}.map`); +function renameDownloadedSourcemapFile() { + const androidName = 'index.android.bundle.map'; + const iosName = 'main.jsbundle.map'; + const downloadSourcemapPath = path.join(sourcemapDir, argsMap.platform === 'ios' ? iosName : androidName); + + if (!fs.existsSync(downloadSourcemapPath)) { + Logger.error(`Could not find the sourcemap file ${downloadSourcemapPath}`); + process.exit(1); + } + + Logger.info(`Renaming sourcemap file to ${localSourceMapPath}`); + fs.renameSync(downloadSourcemapPath, localSourceMapPath); +} + // #endregion -getWorkflowId() - .then((workflowId) => getWorkflowRun(workflowId)) - .then((runId) => getWorkflowRunArtifact(runId, argsMap.platform as 'ios' | 'android')) - .then((artifactId) => getDownloadUrl(artifactId)) - .then((downloadUrl) => {}); +// Step: check if source map locally already exists (if so we can skip the download) +if (fs.existsSync(localSourceMapPath)) { + Logger.success(`Found local source map at ${localSourceMapPath}`); + Logger.info('Skipping download step'); +} else { + // Step: Download the source map for the app version: + getWorkflowId() + .then((workflowId) => getWorkflowRun(workflowId)) + .then((runId) => getWorkflowRunArtifact(runId, argsMap.platform as 'ios' | 'android')) + .then((artifactId) => getDownloadUrl(artifactId)) + .then((downloadUrl) => downloadFile(downloadUrl)) + .then((zipPath) => unpackZipFile(zipPath)) + .then(() => renameDownloadedSourcemapFile()); +} From 758a8616667d7daa401ba2b7c0dff4a09c57a77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 18 Jun 2024 15:44:09 +0200 Subject: [PATCH 03/27] symbolicate --- scripts/symbolicate-profile.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 401a8f744695..69611495c511 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -24,13 +24,13 @@ const argsMap = parseCommandLineArguments(); // #region Input validation if (Object.keys(argsMap).length === 0 || argsMap.help !== undefined) { - Logger.log('Symbolicates a .cpuprofile file obtained from a specific app version.'); + Logger.log('Symbolicates a .cpuprofile file obtained from a specific app version by downloading the source map from the github action runs.'); Logger.log('Usage: npm run symbolicate-profile -- --profile= --platform='); Logger.log('Options:'); - Logger.log(' --profile= The .cpuprofile file to symbolicate'); - Logger.log(' --platform= The platform for which the source map was uploaded'); - Logger.log(' --gh-token Token to use for requests send to the GitHub API. By default tries to pick up from the environment variable GITHUB_TOKEN'); - Logger.log(' --help Display this help message'); + Logger.log(' --profile= The .cpuprofile file to symbolicate'); + Logger.log(' --platform= The platform for which the source map was uploaded'); + Logger.log(' --gh-token Token to use for requests send to the GitHub API. By default tries to pick up from the environment variable GITHUB_TOKEN'); + Logger.log(' --help Display this help message'); process.exit(0); } @@ -86,7 +86,7 @@ function getWorkflowId() { per_page: 100, }) .then((workflowsResponse) => { - const workflow = workflowsResponse.data.workflows.find(({path}) => path === workflowFile); + const workflow = workflowsResponse.data.workflows.find(({path: workflowPath}) => path === workflowFile); if (workflow === undefined) { throw new Error(`Could not find the workflow file ${workflowFile} in results! Has it been renamed?`); } @@ -116,7 +116,7 @@ function getWorkflowRun(workflowId: number) { }) .then((runsResponse) => { if (runsResponse.data.total_count === 0) { - throw new Error(`No successful runs found for the app version ${appVersion}!\nAre you sure the job the upload source map job run successfully?`); + throw new Error(`No successful runs found for the app version ${appVersion}!\nAre you sure the job the upload source map job run successfully (or at all yet)?`); } const run = runsResponse.data.workflow_runs[0]; @@ -260,3 +260,8 @@ if (fs.existsSync(localSourceMapPath)) { .then((zipPath) => unpackZipFile(zipPath)) .then(() => renameDownloadedSourcemapFile()); } + +// Symbolicate using the downloaded source map + +const command = `npx react-native-release-profiler --local ${argsMap.profile} --sourcemap-path ${localSourceMapPath}`; +execSync(command, {stdio: 'inherit'}); \ No newline at end of file From 58588b90763806217e5b7aa370f038375ed86656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 18 Jun 2024 15:46:08 +0200 Subject: [PATCH 04/27] fix help command + lint --- scripts/symbolicate-profile.ts | 2 +- scripts/utils/parseCommandLineArguments.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 69611495c511..489d721cb563 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -86,7 +86,7 @@ function getWorkflowId() { per_page: 100, }) .then((workflowsResponse) => { - const workflow = workflowsResponse.data.workflows.find(({path: workflowPath}) => path === workflowFile); + const workflow = workflowsResponse.data.workflows.find(({path: workflowPath}) => workflowPath === workflowFile); if (workflow === undefined) { throw new Error(`Could not find the workflow file ${workflowFile} in results! Has it been renamed?`); } diff --git a/scripts/utils/parseCommandLineArguments.ts b/scripts/utils/parseCommandLineArguments.ts index c33c07972b01..9bb1d340335e 100644 --- a/scripts/utils/parseCommandLineArguments.ts +++ b/scripts/utils/parseCommandLineArguments.ts @@ -7,7 +7,12 @@ export default function parseCommandLineArguments(): ArgsMap { args.forEach((arg) => { const [key, value] = arg.split('='); if (key.startsWith('--')) { - argsMap[key.substring(2)] = value; + const name = key.substring(2); + argsMap[name] = value; + // User may provide a help arg without any value + if (name.toLowerCase() === 'help' && !value) { + argsMap[name] = 'true'; + } } }); return argsMap; From a892234fcfcec5a68f8662282c86d2dfdcb98444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 18 Jun 2024 17:19:01 +0200 Subject: [PATCH 05/27] lint --- scripts/utils/Logger.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/utils/Logger.ts b/scripts/utils/Logger.ts index 9cd04ba2b6b9..a851f11ff74f 100644 --- a/scripts/utils/Logger.ts +++ b/scripts/utils/Logger.ts @@ -4,7 +4,6 @@ const COLOR_YELLOW = '\x1b[33m'; const COLOR_RED = '\x1b[31m'; const COLOR_GREEN = '\x1b[32m'; - const log = (...args: unknown[]) => { console.debug(...args); }; @@ -33,6 +32,6 @@ const error = (...args: unknown[]) => { log(...lines); }; -const formatLink = (name: string | number, url: string) => `\x1b]8;;${url}\x1b\\${name}\x1b]8;;\x1b\\` +const formatLink = (name: string | number, url: string) => `\x1b]8;;${url}\x1b\\${name}\x1b]8;;\x1b\\`; -export {log, info, warn, note, error, success, formatLink}; \ No newline at end of file +export {log, info, warn, note, error, success, formatLink}; From 1f486223aded430410c531080f025c3aaa9ae3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 18 Jun 2024 17:19:08 +0200 Subject: [PATCH 06/27] fix bugs --- scripts/symbolicate-profile.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 489d721cb563..327b94b826cb 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -244,12 +244,19 @@ function renameDownloadedSourcemapFile() { fs.renameSync(downloadSourcemapPath, localSourceMapPath); } +// Symbolicate using the downloaded source map +function symbolicateProfile() { + const command = `npx react-native-release-profiler --local ${argsMap.profile} --sourcemap-path ${localSourceMapPath}`; + execSync(command, {stdio: 'inherit'}); +} + // #endregion // Step: check if source map locally already exists (if so we can skip the download) if (fs.existsSync(localSourceMapPath)) { Logger.success(`Found local source map at ${localSourceMapPath}`); Logger.info('Skipping download step'); + symbolicateProfile(); } else { // Step: Download the source map for the app version: getWorkflowId() @@ -258,10 +265,6 @@ if (fs.existsSync(localSourceMapPath)) { .then((artifactId) => getDownloadUrl(artifactId)) .then((downloadUrl) => downloadFile(downloadUrl)) .then((zipPath) => unpackZipFile(zipPath)) - .then(() => renameDownloadedSourcemapFile()); + .then(() => renameDownloadedSourcemapFile()) + .then(() => symbolicateProfile()); } - -// Symbolicate using the downloaded source map - -const command = `npx react-native-release-profiler --local ${argsMap.profile} --sourcemap-path ${localSourceMapPath}`; -execSync(command, {stdio: 'inherit'}); \ No newline at end of file From 9fa77dd15aecdf9f794c6a211dcf0754bf5c8324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 16:57:18 +0200 Subject: [PATCH 07/27] simplify fetching artifact by using artifact name --- scripts/symbolicate-profile.ts | 84 +++++----------------------------- 1 file changed, 11 insertions(+), 73 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 327b94b826cb..d4154ab88556 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -9,8 +9,10 @@ * * 1. When creating a new deployment in our github actions, we upload the source map for android and iOS as artifacts. * 2. The profiles created by the app on the user's device have the app version encoded in the filename. - * 3. This script takes in a .cpuprofile file, reads the app version from the filename, and downloads the corresponding source map from the artifacts. + * 3. This script takes in a .cpuprofile file, reads the app version from the filename, and downloads the corresponding source map from the artifacts using github's API. * 4. It then uses the source map to symbolicate the .cpuprofile file using the `react-native-release-profiler` cli. + * + * @note For downloading an artefact a github token is required. */ import {Octokit} from '@octokit/core'; import {execSync} from 'child_process'; @@ -73,82 +75,20 @@ const octokit = new Octokit({auth: githubToken}); const OWNER = 'Expensify'; const REPO = 'App'; -function getWorkflowId() { - // Step 1: Find the workflow id - // Note: we could hard code it, but this way its simpler if the job changes in the future - const workflowFile = '.github/workflows/platformDeploy.yml'; - Logger.info(`Fetching workflow id for the source map job from ${workflowFile}`); - - return octokit - .request('GET /repos/{owner}/{repo}/actions/workflows', { - owner: OWNER, - repo: REPO, - per_page: 100, - }) - .then((workflowsResponse) => { - const workflow = workflowsResponse.data.workflows.find(({path: workflowPath}) => workflowPath === workflowFile); - if (workflow === undefined) { - throw new Error(`Could not find the workflow file ${workflowFile} in results! Has it been renamed?`); - } - return workflow.id; - }) - .catch((error) => { - Logger.error('Failed to fetch workflows to get the id for the source map job'); - Logger.error(error); - throw error; - }); -} - -function getWorkflowRun(workflowId: number) { - Logger.info(`Fetching workflow runs for workflow id ${workflowId} for branch ${appVersion}`); +function getWorkflowRunArtifact() { + const artefactName = `${argsMap.platform}-sourcemap-${appVersion}`; + Logger.info(`Fetching sourcemap artifact with name "${artefactName}"`); return octokit - .request('GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs', { + .request('GET /repos/{owner}/{repo}/actions/artifacts', { owner: OWNER, repo: REPO, - workflow_id: workflowId, - // For each app version a new branch is created, so we can filter by branch. - branch: appVersion, - // There should only be one successful deploy job for a given app version per_page: 1, - // Note: the workflow run could fail for different jobs. If its completed its possible the sourcemaps have been uploaded. - // If the source map is not present, we will fail on the next step. - status: 'completed', - }) - .then((runsResponse) => { - if (runsResponse.data.total_count === 0) { - throw new Error(`No successful runs found for the app version ${appVersion}!\nAre you sure the job the upload source map job run successfully (or at all yet)?`); - } - - const run = runsResponse.data.workflow_runs[0]; - if (run.status !== 'success') { - Logger.warn(`The run ${Logger.formatLink(run.id, run.html_url)} was not successful. The source map _might_ not be uploaded.`); - } else { - Logger.success(`Found successful run ${Logger.formatLink(run.id, run.html_url)} for app version ${appVersion}`); - } - - return run.id; - }) - .catch((error) => { - Logger.error('Failed to fetch workflow runs for the app version'); - Logger.error(error); - throw error; - }); -} - -function getWorkflowRunArtifact(runId: number, platform: 'ios' | 'android') { - const artefactName = `${platform}-sourcemap`; - Logger.info(`Fetching sourcemap artifact for run id ${runId} with name "${artefactName}"`); - return octokit - .request('GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts', { - owner: OWNER, - repo: REPO, - run_id: runId, name: artefactName, }) .then((artifactsResponse) => { - const artifact = artifactsResponse.data.artifacts.find(({name}) => name === artefactName); + const artifact = artifactsResponse.data.artifacts[0] if (artifact === undefined) { - throw new Error(`Could not find the artifact ${artefactName} in results!`); + throw new Error(`Could not find the artifact ${artefactName}!`); } return artifact.id; }) @@ -199,7 +139,7 @@ function downloadFile(url: string) { fs.mkdirSync(sourcemapDir); } - const destination = path.join(sourcemapDir, `${argsMap.platform}-${appVersion}-sourcemap.zip`); + const destination = path.join(sourcemapDir, `${argsMap.platform}-sourcemap-${appVersion}.zip`); const file = fs.createWriteStream(destination); return new Promise((resolve, reject) => { https @@ -259,9 +199,7 @@ if (fs.existsSync(localSourceMapPath)) { symbolicateProfile(); } else { // Step: Download the source map for the app version: - getWorkflowId() - .then((workflowId) => getWorkflowRun(workflowId)) - .then((runId) => getWorkflowRunArtifact(runId, argsMap.platform as 'ios' | 'android')) + getWorkflowRunArtifact() .then((artifactId) => getDownloadUrl(artifactId)) .then((downloadUrl) => downloadFile(downloadUrl)) .then((zipPath) => unpackZipFile(zipPath)) From a9a31cb9ea2124acfcab489d247cad974fefad68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 17:07:54 +0200 Subject: [PATCH 08/27] run prettier --- scripts/symbolicate-profile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index d4154ab88556..b220524a8c6a 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -11,7 +11,7 @@ * 2. The profiles created by the app on the user's device have the app version encoded in the filename. * 3. This script takes in a .cpuprofile file, reads the app version from the filename, and downloads the corresponding source map from the artifacts using github's API. * 4. It then uses the source map to symbolicate the .cpuprofile file using the `react-native-release-profiler` cli. - * + * * @note For downloading an artefact a github token is required. */ import {Octokit} from '@octokit/core'; @@ -86,7 +86,7 @@ function getWorkflowRunArtifact() { name: artefactName, }) .then((artifactsResponse) => { - const artifact = artifactsResponse.data.artifacts[0] + const artifact = artifactsResponse.data.artifacts[0]; if (artifact === undefined) { throw new Error(`Could not find the artifact ${artefactName}!`); } From 2ca85c6d0a3803289a16334fa30a31a66b537c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 23:05:34 +0200 Subject: [PATCH 09/27] Update scripts/symbolicate-profile.ts Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- scripts/symbolicate-profile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index b220524a8c6a..502f47a1afe2 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -12,7 +12,7 @@ * 3. This script takes in a .cpuprofile file, reads the app version from the filename, and downloads the corresponding source map from the artifacts using github's API. * 4. It then uses the source map to symbolicate the .cpuprofile file using the `react-native-release-profiler` cli. * - * @note For downloading an artefact a github token is required. + * @note For downloading an artifact a github token is required. */ import {Octokit} from '@octokit/core'; import {execSync} from 'child_process'; From 70164062fa7f43a2e8ef8f0696493b10bcbc28b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 19 Jun 2024 23:05:53 +0200 Subject: [PATCH 10/27] Update src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx b/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx index 7fd1cdc4b14e..5593ad627e92 100644 --- a/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx +++ b/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx @@ -44,7 +44,7 @@ function formatBytes(bytes: number, decimals = 2) { return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`; } -// NOTE: When changing this name make sure that the "scripts/symbolicate-profile.ts" script is still working! +// WARNING: When changing this name make sure that the "scripts/symbolicate-profile.ts" script is still working! const newFileName = `Profile_trace_for_${pkg.version}.cpuprofile`; function BaseProfilingToolMenu({isProfilingInProgress = false, pathToBeUsed, displayPath}: BaseProfilingToolMenuProps) { From cf70af84ae97055bf88a467ea803e587fef84c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 09:41:26 +0200 Subject: [PATCH 11/27] rename artefact -> artifact --- scripts/symbolicate-profile.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index b220524a8c6a..3fee7c709339 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -12,7 +12,7 @@ * 3. This script takes in a .cpuprofile file, reads the app version from the filename, and downloads the corresponding source map from the artifacts using github's API. * 4. It then uses the source map to symbolicate the .cpuprofile file using the `react-native-release-profiler` cli. * - * @note For downloading an artefact a github token is required. + * @note For downloading an artifact a github token is required. */ import {Octokit} from '@octokit/core'; import {execSync} from 'child_process'; @@ -76,19 +76,19 @@ const OWNER = 'Expensify'; const REPO = 'App'; function getWorkflowRunArtifact() { - const artefactName = `${argsMap.platform}-sourcemap-${appVersion}`; - Logger.info(`Fetching sourcemap artifact with name "${artefactName}"`); + const artifactName = `${argsMap.platform}-sourcemap-${appVersion}`; + Logger.info(`Fetching sourcemap artifact with name "${artifactName}"`); return octokit .request('GET /repos/{owner}/{repo}/actions/artifacts', { owner: OWNER, repo: REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((artifactsResponse) => { const artifact = artifactsResponse.data.artifacts[0]; if (artifact === undefined) { - throw new Error(`Could not find the artifact ${artefactName}!`); + throw new Error(`Could not find the artifact ${artifactName}!`); } return artifact.id; }) From 95bdfa87a164c4ac680cefe3022a14b08efa37b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 09:53:54 +0200 Subject: [PATCH 12/27] improve GithubUtils.getArtifactByName to not paginate through all artifacts, but use the name query parameter directly --- .github/libs/GithubUtils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index f445fc368559..e8e7836edbe0 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -522,11 +522,12 @@ class GithubUtils { } static getArtifactByName(artefactName: string): Promise { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST.GITHUB_OWNER, repo: CONST.APP_REPO, - per_page: 100, - }).then((artifacts: OctokitArtifact[]) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); } } From e4455280a933a255761866b5f64c9b34b862d8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:17:18 +0200 Subject: [PATCH 13/27] refactor to allow for setup with token + add getArtifactDownloadURL helper fct --- .github/libs/GithubUtils.ts | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index e8e7836edbe0..cb8c16670e9c 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -65,13 +65,11 @@ class GithubUtils { static internalOctokit: InternalOctokit | undefined; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token: string) { const Octokit = GitHub.plugin(throttling, paginateRest); - const token = core.getInput('GITHUB_TOKEN', {required: true}); // Save a copy of octokit used in this class this.internalOctokit = new Octokit( @@ -96,6 +94,16 @@ class GithubUtils { ); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', {required: true}); + this.initOctokitWithToken(token) + } + /** * Either give an existing instance of Octokit rest or create a new one * @@ -521,6 +529,9 @@ class GithubUtils { .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName: string): Promise { return this.octokit.actions.listArtifactsForRepo({ owner: CONST.GITHUB_OWNER, @@ -529,6 +540,17 @@ class GithubUtils { name: artefactName, }).then((response) => response.data.artifacts[0]); } + + static getArtifactDownloadURL(artifactId: number): Promise { + return this.octokit.actions + .downloadArtifact({ + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url) + } } export default GithubUtils; From 9577da0c3a5dd9004f5b066840ba8afcd1c83ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:17:26 +0200 Subject: [PATCH 14/27] allow async/await in scripts --- scripts/.eslintrc.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/.eslintrc.js diff --git a/scripts/.eslintrc.js b/scripts/.eslintrc.js new file mode 100644 index 000000000000..d6d39822b737 --- /dev/null +++ b/scripts/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + rules: { + // For all these Node.js scripts, we do not want to disable `console` statements + 'no-console': 'off', + + '@lwc/lwc/no-async-await': 'off', + 'no-await-in-loop': 'off', + 'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], + }, +}; From 6896ff14921907e564d8d7c3ef4cb4882c30da82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:17:32 +0200 Subject: [PATCH 15/27] use GithubUtils --- scripts/symbolicate-profile.ts | 101 +++++++++++---------------------- 1 file changed, 33 insertions(+), 68 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 3fee7c709339..4e0e4cd65772 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -14,11 +14,11 @@ * * @note For downloading an artifact a github token is required. */ -import {Octokit} from '@octokit/core'; import {execSync} from 'child_process'; import fs from 'fs'; import https from 'https'; import path from 'path'; +import GithubUtils from '@github/libs/GithubUtils'; import * as Logger from './utils/Logger'; import parseCommandLineArguments from './utils/parseCommandLineArguments'; @@ -55,6 +55,8 @@ if (githubToken === undefined) { Logger.error('No GitHub token provided. Either set a GITHUB_TOKEN environment variable or pass it using --gh-token'); process.exit(1); } + +GithubUtils.initOctokitWithToken(githubToken); // #endregion // #region Get the app version @@ -70,63 +72,14 @@ Logger.info(`Found app version ${appVersion} in the profile filename`); // #endregion // #region Utility functions -// We need the token for the download step -const octokit = new Octokit({auth: githubToken}); -const OWNER = 'Expensify'; -const REPO = 'App'; - -function getWorkflowRunArtifact() { +async function getWorkflowRunArtifact() { const artifactName = `${argsMap.platform}-sourcemap-${appVersion}`; Logger.info(`Fetching sourcemap artifact with name "${artifactName}"`); - return octokit - .request('GET /repos/{owner}/{repo}/actions/artifacts', { - owner: OWNER, - repo: REPO, - per_page: 1, - name: artifactName, - }) - .then((artifactsResponse) => { - const artifact = artifactsResponse.data.artifacts[0]; - if (artifact === undefined) { - throw new Error(`Could not find the artifact ${artifactName}!`); - } - return artifact.id; - }) - .catch((error) => { - Logger.error('Failed to get artifact!'); - Logger.error(error); - throw error; - }); -} - -function getDownloadUrl(artifactId: number) { - // https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact - // Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. - // Look for Location: in the response header to find the URL for the download. - - Logger.log(`Getting download URL for artifact…`); - return octokit - .request('GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}', { - owner: OWNER, - repo: REPO, - artifact_id: artifactId, - archive_format: 'zip', - }) - .then((response) => { - // The response should be a redirect to the actual download URL - const downloadUrl = response.url; - - if (downloadUrl === undefined) { - throw new Error(`Could not find the download URL in:\n${JSON.stringify(response, null, 2)}`); - } - - return downloadUrl; - }) - .catch((error) => { - Logger.error('Failed to download artifact!'); - Logger.error(error); - throw error; - }); + const artifact = await GithubUtils.getArtifactByName(artifactName); + if (artifact === undefined) { + throw new Error(`Could not find the artifact ${artifactName}! Are you sure the deploy step succeeded?`); + } + return artifact.id; } const dirName = '.sourcemaps'; @@ -190,19 +143,31 @@ function symbolicateProfile() { execSync(command, {stdio: 'inherit'}); } +async function fetchAndProcessArtifact() { + const artifactId = await getWorkflowRunArtifact(); + const downloadUrl = await GithubUtils.getArtifactDownloadURL(artifactId); + const zipPath = await downloadFile(downloadUrl); + await unpackZipFile(zipPath); + renameDownloadedSourcemapFile(); +} // #endregion -// Step: check if source map locally already exists (if so we can skip the download) -if (fs.existsSync(localSourceMapPath)) { - Logger.success(`Found local source map at ${localSourceMapPath}`); - Logger.info('Skipping download step'); +async function runAsyncScript() { + // Step: check if source map locally already exists (if so we can skip the download) + if (fs.existsSync(localSourceMapPath)) { + Logger.success(`Found local source map at ${localSourceMapPath}`); + Logger.info('Skipping download step'); + } else { + // Step: Download the source map for the app version and then symbolicate the profile: + try { + await fetchAndProcessArtifact(); + } catch (error) { + Logger.error(error); + process.exit(1); + } + } + symbolicateProfile(); -} else { - // Step: Download the source map for the app version: - getWorkflowRunArtifact() - .then((artifactId) => getDownloadUrl(artifactId)) - .then((downloadUrl) => downloadFile(downloadUrl)) - .then((zipPath) => unpackZipFile(zipPath)) - .then(() => renameDownloadedSourcemapFile()) - .then(() => symbolicateProfile()); } + +runAsyncScript(); From 33369b9a72d0cc00ad35311027094f429be28022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:19:34 +0200 Subject: [PATCH 16/27] re=compile gh actions --- .../javascript/authorChecklist/index.js | 37 +++++++++++++++---- .../javascript/awaitStagingDeploys/index.js | 37 +++++++++++++++---- .../javascript/checkDeployBlockers/index.js | 37 +++++++++++++++---- .../createOrUpdateStagingDeploy/index.js | 37 +++++++++++++++---- .../javascript/getArtifactInfo/index.js | 37 +++++++++++++++---- .../getDeployPullRequestList/index.js | 37 +++++++++++++++---- .../javascript/getPullRequestDetails/index.js | 37 +++++++++++++++---- .../javascript/getReleaseBody/index.js | 37 +++++++++++++++---- .../javascript/isStagingDeployLocked/index.js | 37 +++++++++++++++---- .../markPullRequestsAsDeployed/index.js | 37 +++++++++++++++---- .../javascript/postTestBuildComment/index.js | 37 +++++++++++++++---- .../reopenIssueWithComment/index.js | 37 +++++++++++++++---- .../javascript/reviewerChecklist/index.js | 37 +++++++++++++++---- .../javascript/verifySignedCommits/index.js | 37 +++++++++++++++---- 14 files changed, 406 insertions(+), 112 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 337fe7398fb3..91496a682d24 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -17073,13 +17073,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -17099,6 +17097,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -17454,12 +17461,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 0e0168fdb7ae..f0c8e8adbd2f 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12314,13 +12314,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -12340,6 +12338,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -12695,12 +12702,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index 842deb1cbb5d..d46268174dae 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -11597,13 +11597,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11623,6 +11621,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -11978,12 +11985,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index 127fb1fe3dca..d8740553ba6d 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -14567,13 +14567,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -14593,6 +14591,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -14948,12 +14955,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index 77f61f491fec..78dcba306562 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -11558,13 +11558,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11584,6 +11582,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -11939,12 +11946,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 8f9f9deea896..f07d24cc2e53 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -11831,13 +11831,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11857,6 +11855,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -12212,12 +12219,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 14814367e3cd..61330acc9693 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -11660,13 +11660,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11686,6 +11684,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -12041,12 +12048,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/getReleaseBody/index.js b/.github/actions/javascript/getReleaseBody/index.js index 6c746e26a4a4..e3886b3c7fd6 100644 --- a/.github/actions/javascript/getReleaseBody/index.js +++ b/.github/actions/javascript/getReleaseBody/index.js @@ -11604,13 +11604,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11630,6 +11628,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -11985,12 +11992,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/isStagingDeployLocked/index.js b/.github/actions/javascript/isStagingDeployLocked/index.js index f71b89dc051c..028cd607d94a 100644 --- a/.github/actions/javascript/isStagingDeployLocked/index.js +++ b/.github/actions/javascript/isStagingDeployLocked/index.js @@ -11558,13 +11558,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11584,6 +11582,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -11939,12 +11946,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index 804d3ea610f3..5c38176086ff 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -11755,13 +11755,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11781,6 +11779,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -12136,12 +12143,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index 0b8eb29f1750..296cc98fdc5b 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -11657,13 +11657,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11683,6 +11681,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -12038,12 +12045,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index d4341ce37dc4..8bc24c1890f1 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -11568,13 +11568,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11594,6 +11592,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -11949,12 +11956,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index cc1c0b5a581b..c1e7e1998263 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -11660,13 +11660,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11686,6 +11684,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -12041,12 +12048,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index aea35331b1d0..a0115921ce85 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -11600,13 +11600,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873)); class GithubUtils { static internalOctokit; /** - * Initialize internal octokit - * - * @private + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. */ - static initOctokit() { + static initOctokitWithToken(token) { const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - const token = core.getInput('GITHUB_TOKEN', { required: true }); // Save a copy of octokit used in this class this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { throttle: { @@ -11626,6 +11624,15 @@ class GithubUtils { }, })); } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } /** * Either give an existing instance of Octokit rest or create a new one * @@ -11981,12 +11988,26 @@ class GithubUtils { .then((events) => events.filter((event) => event.event === 'closed')) .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ static getArtifactByName(artefactName) { - return this.paginate(this.octokit.actions.listArtifactsForRepo, { + return this.octokit.actions.listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - per_page: 100, - }).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName)); + per_page: 1, + name: artefactName, + }).then((response) => response.data.artifacts[0]); + } + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); } } exports["default"] = GithubUtils; From c27a4d290e78ad6822f514a6e4d88fec6880d209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:20:35 +0200 Subject: [PATCH 17/27] comment --- scripts/symbolicate-profile.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 4e0e4cd65772..ab2d7478ba78 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -167,6 +167,7 @@ async function runAsyncScript() { } } + // Finally, symbolicate the profile symbolicateProfile(); } From 765a77f13b37010eb7a1e55bbf7177ba15f1ee7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:38:13 +0200 Subject: [PATCH 18/27] setup tsconfig-paths + tsconfig using it in ./scripts to use paths --- package-lock.json | 82 +++++++++++++++++++++++-------------------- package.json | 4 ++- scripts/tsconfig.json | 6 ++++ 3 files changed, 52 insertions(+), 40 deletions(-) create mode 100644 scripts/tsconfig.json diff --git a/package-lock.json b/package-lock.json index b28386caffca..cf97453d5142 100644 --- a/package-lock.json +++ b/package-lock.json @@ -241,6 +241,7 @@ "time-analytics-webpack-plugin": "^0.1.17", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", + "tsconfig-paths": "^4.2.0", "type-fest": "^4.10.2", "typescript": "^5.4.5", "wait-port": "^0.2.9", @@ -11103,29 +11104,6 @@ "node": ">=14.14" } }, - "node_modules/@storybook/preset-react-webpack/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@storybook/preset-react-webpack/node_modules/tsconfig-paths": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", - "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", - "dev": true, - "dependencies": { - "json5": "^2.2.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/@storybook/preview": { "version": "8.0.6", "resolved": "https://registry.npmjs.org/@storybook/preview/-/preview-8.0.6.tgz", @@ -12474,8 +12452,9 @@ }, "node_modules/@types/json5": { "version": "0.0.29", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true }, "node_modules/@types/keyv": { "version": "3.1.4", @@ -20016,6 +19995,18 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-import/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/eslint-plugin-import/node_modules/semver": { "version": "6.3.1", "dev": true, @@ -20024,6 +20015,27 @@ "semver": "bin/semver.js" } }, + "node_modules/eslint-plugin-import/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-import/node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, "node_modules/eslint-plugin-jest": { "version": "24.7.0", "dev": true, @@ -36376,25 +36388,17 @@ "license": "Apache-2.0" }, "node_modules/tsconfig-paths": { - "version": "3.15.0", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", "dev": true, - "license": "MIT", "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", + "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" - } - }, - "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.0" }, - "bin": { - "json5": "lib/cli.js" + "engines": { + "node": ">=6" } }, "node_modules/tsconfig-paths/node_modules/strip-bom": { diff --git a/package.json b/package.json index 73f9fdc56195..8df85159e1aa 100644 --- a/package.json +++ b/package.json @@ -294,6 +294,7 @@ "time-analytics-webpack-plugin": "^0.1.17", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", + "tsconfig-paths": "^4.2.0", "type-fest": "^4.10.2", "typescript": "^5.4.5", "wait-port": "^0.2.9", @@ -334,5 +335,6 @@ "engines": { "node": "20.14.0", "npm": "10.7.0" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 000000000000..2d548a3aa2ce --- /dev/null +++ b/scripts/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "ts-node": { + "require": ["tsconfig-paths/register"] + } +} From e3229b22a77cb82c4de9b4910645f89899b6b7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:39:27 +0200 Subject: [PATCH 19/27] run prettier --- .github/libs/GithubUtils.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index cb8c16670e9c..bc80fcab8c74 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -96,12 +96,12 @@ class GithubUtils { /** * Default initialize method assuming running in CI, getting the token from an input. - * + * * @private */ static initOctokit() { const token = core.getInput('GITHUB_TOKEN', {required: true}); - this.initOctokitWithToken(token) + this.initOctokitWithToken(token); } /** @@ -533,12 +533,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName: string): Promise { - return this.octokit.actions.listArtifactsForRepo({ - owner: CONST.GITHUB_OWNER, - repo: CONST.APP_REPO, - per_page: 1, - name: artefactName, - }).then((response) => response.data.artifacts[0]); + return this.octokit.actions + .listArtifactsForRepo({ + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + per_page: 1, + name: artefactName, + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId: number): Promise { @@ -549,7 +551,7 @@ class GithubUtils { artifact_id: artifactId, archive_format: 'zip', }) - .then((response) => response.url) + .then((response) => response.url); } } From 0aae6f468e7012d3c323ce0be9743e8bff62bb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:41:46 +0200 Subject: [PATCH 20/27] use region comments --- scripts/symbolicate-profile.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index ab2d7478ba78..8461bba94d0e 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -24,7 +24,8 @@ import parseCommandLineArguments from './utils/parseCommandLineArguments'; const argsMap = parseCommandLineArguments(); -// #region Input validation +/* ============== INPUT VALIDATION ============== */ + if (Object.keys(argsMap).length === 0 || argsMap.help !== undefined) { Logger.log('Symbolicates a .cpuprofile file obtained from a specific app version by downloading the source map from the github action runs.'); Logger.log('Usage: npm run symbolicate-profile -- --profile= --platform='); @@ -57,9 +58,8 @@ if (githubToken === undefined) { } GithubUtils.initOctokitWithToken(githubToken); -// #endregion -// #region Get the app version +/* ============= EXTRACT APP VERSION ============= */ // Formatted as "Profile_trace_for_1.4.81-9.cpuprofile" const appVersionRegex = /\d+\.\d+\.\d+(-\d+)?/; @@ -69,9 +69,9 @@ if (appVersion === undefined) { process.exit(1); } Logger.info(`Found app version ${appVersion} in the profile filename`); -// #endregion -// #region Utility functions +/* ============== UTILITY FUNCTIONS ============== */ + async function getWorkflowRunArtifact() { const artifactName = `${argsMap.platform}-sourcemap-${appVersion}`; Logger.info(`Fetching sourcemap artifact with name "${artifactName}"`); @@ -150,7 +150,8 @@ async function fetchAndProcessArtifact() { await unpackZipFile(zipPath); renameDownloadedSourcemapFile(); } -// #endregion + +/* ============== MAIN SCRIPT ============== */ async function runAsyncScript() { // Step: check if source map locally already exists (if so we can skip the download) From 2a717f630d9f86aa99c56877bf5291a6362bb1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 10:45:05 +0200 Subject: [PATCH 21/27] make script executable from any location within the project --- scripts/symbolicate-profile.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 8461bba94d0e..a100c05029dd 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -82,8 +82,7 @@ async function getWorkflowRunArtifact() { return artifact.id; } -const dirName = '.sourcemaps'; -const sourcemapDir = path.join(process.cwd(), dirName); +const sourcemapDir = path.resolve(__dirname, '../.sourcemaps'); function downloadFile(url: string) { Logger.log(`Downloading file from URL: ${url}`); From d35947b78538107d8757f67c64a1baf2523408d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 21:49:29 +0200 Subject: [PATCH 22/27] remove unwanted changes --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 8df85159e1aa..3ee9aedf0be9 100644 --- a/package.json +++ b/package.json @@ -335,6 +335,5 @@ "engines": { "node": "20.14.0", "npm": "10.7.0" - }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + } } From 742d9d7530ba51b5b8699f1d9e8a36687da45e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 21:50:45 +0200 Subject: [PATCH 23/27] ran gh-actions-build --- .github/actions/javascript/authorChecklist/index.js | 6 ++++-- .github/actions/javascript/awaitStagingDeploys/index.js | 6 ++++-- .github/actions/javascript/checkDeployBlockers/index.js | 6 ++++-- .../actions/javascript/createOrUpdateStagingDeploy/index.js | 6 ++++-- .github/actions/javascript/getArtifactInfo/index.js | 6 ++++-- .../actions/javascript/getDeployPullRequestList/index.js | 6 ++++-- .github/actions/javascript/getPullRequestDetails/index.js | 6 ++++-- .github/actions/javascript/getReleaseBody/index.js | 6 ++++-- .github/actions/javascript/isStagingDeployLocked/index.js | 6 ++++-- .../actions/javascript/markPullRequestsAsDeployed/index.js | 6 ++++-- .github/actions/javascript/postTestBuildComment/index.js | 6 ++++-- .github/actions/javascript/reopenIssueWithComment/index.js | 6 ++++-- .github/actions/javascript/reviewerChecklist/index.js | 6 ++++-- .github/actions/javascript/verifySignedCommits/index.js | 6 ++++-- 14 files changed, 56 insertions(+), 28 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 91496a682d24..e32716a5faf7 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -17465,12 +17465,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index f0c8e8adbd2f..734a31c13748 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12706,12 +12706,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index d46268174dae..e8b9c2a73fa0 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -11989,12 +11989,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index d8740553ba6d..81f058175d0a 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -14959,12 +14959,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index 78dcba306562..0b6f6b313a4f 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -11950,12 +11950,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index f07d24cc2e53..07d2598d551f 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -12223,12 +12223,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 61330acc9693..4ab79b942064 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -12052,12 +12052,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/getReleaseBody/index.js b/.github/actions/javascript/getReleaseBody/index.js index e3886b3c7fd6..ab4d51ca1f93 100644 --- a/.github/actions/javascript/getReleaseBody/index.js +++ b/.github/actions/javascript/getReleaseBody/index.js @@ -11996,12 +11996,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/isStagingDeployLocked/index.js b/.github/actions/javascript/isStagingDeployLocked/index.js index 028cd607d94a..e0d7e06e6efb 100644 --- a/.github/actions/javascript/isStagingDeployLocked/index.js +++ b/.github/actions/javascript/isStagingDeployLocked/index.js @@ -11950,12 +11950,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index 5c38176086ff..e8ad7fdcb841 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -12147,12 +12147,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index 296cc98fdc5b..bc536de3443c 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -12049,12 +12049,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index 8bc24c1890f1..f134cf61499b 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -11960,12 +11960,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index c1e7e1998263..249656f4799a 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -12052,12 +12052,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index a0115921ce85..28e5c6e1bd2e 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -11992,12 +11992,14 @@ class GithubUtils { * Returns a single artifact by name. If none is found, it returns undefined. */ static getArtifactByName(artefactName) { - return this.octokit.actions.listArtifactsForRepo({ + return this.octokit.actions + .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, name: artefactName, - }).then((response) => response.data.artifacts[0]); + }) + .then((response) => response.data.artifacts[0]); } static getArtifactDownloadURL(artifactId) { return this.octokit.actions From eb165d85d3f97247ec7a8e4fcef927493cc831d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 22:00:36 +0200 Subject: [PATCH 24/27] add EOF --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index af58eaf0ad6c..aa6aad4cc429 100644 --- a/.gitignore +++ b/.gitignore @@ -132,4 +132,4 @@ dist/ web-build/ # Storage location for downloaded app source maps (see scripts/symbolicate-profile.ts) -.sourcemaps/ \ No newline at end of file +.sourcemaps/ From 0849924b2783030477f6adaf4b6f52909284d507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 22:01:06 +0200 Subject: [PATCH 25/27] fix parameter name spelling --- .github/libs/GithubUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index bc80fcab8c74..5a94bec9e484 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -532,13 +532,13 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName: string): Promise { + static getArtifactByName(artifactName: string): Promise { return this.octokit.actions .listArtifactsForRepo({ owner: CONST.GITHUB_OWNER, repo: CONST.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } From 2942479270630281e582188e87006b762452256b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 22:01:45 +0200 Subject: [PATCH 26/27] jsdoc comment --- .github/libs/GithubUtils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index 5a94bec9e484..73553cb46bff 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -543,6 +543,9 @@ class GithubUtils { .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId: number): Promise { return this.octokit.actions .downloadArtifact({ From 4b70c73c58a5bffe8bf9aaaee1e77277663acf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 20 Jun 2024 22:03:17 +0200 Subject: [PATCH 27/27] ran gh-actions-build --- .github/actions/javascript/authorChecklist/index.js | 7 +++++-- .github/actions/javascript/awaitStagingDeploys/index.js | 7 +++++-- .github/actions/javascript/checkDeployBlockers/index.js | 7 +++++-- .../javascript/createOrUpdateStagingDeploy/index.js | 7 +++++-- .github/actions/javascript/getArtifactInfo/index.js | 7 +++++-- .../actions/javascript/getDeployPullRequestList/index.js | 7 +++++-- .github/actions/javascript/getPullRequestDetails/index.js | 7 +++++-- .github/actions/javascript/getReleaseBody/index.js | 7 +++++-- .github/actions/javascript/isStagingDeployLocked/index.js | 7 +++++-- .../actions/javascript/markPullRequestsAsDeployed/index.js | 7 +++++-- .github/actions/javascript/postTestBuildComment/index.js | 7 +++++-- .github/actions/javascript/reopenIssueWithComment/index.js | 7 +++++-- .github/actions/javascript/reviewerChecklist/index.js | 7 +++++-- .github/actions/javascript/verifySignedCommits/index.js | 7 +++++-- 14 files changed, 70 insertions(+), 28 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index e32716a5faf7..1dace19d0a01 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -17464,16 +17464,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 734a31c13748..c5ba4d9ca936 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12705,16 +12705,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index e8b9c2a73fa0..0817a8130adc 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -11988,16 +11988,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index 81f058175d0a..12b3165c1ead 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -14958,16 +14958,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index 0b6f6b313a4f..9a7a0ae62e53 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -11949,16 +11949,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 07d2598d551f..f63cd2a14f5b 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -12222,16 +12222,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 4ab79b942064..7cb768941711 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -12051,16 +12051,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/getReleaseBody/index.js b/.github/actions/javascript/getReleaseBody/index.js index ab4d51ca1f93..f6ba78030927 100644 --- a/.github/actions/javascript/getReleaseBody/index.js +++ b/.github/actions/javascript/getReleaseBody/index.js @@ -11995,16 +11995,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/isStagingDeployLocked/index.js b/.github/actions/javascript/isStagingDeployLocked/index.js index e0d7e06e6efb..29c010f086c3 100644 --- a/.github/actions/javascript/isStagingDeployLocked/index.js +++ b/.github/actions/javascript/isStagingDeployLocked/index.js @@ -11949,16 +11949,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index e8ad7fdcb841..1256b6425640 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -12146,16 +12146,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index bc536de3443c..fef09bc25c56 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -12048,16 +12048,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index f134cf61499b..b211f301eb67 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -11959,16 +11959,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index 249656f4799a..b53863ef0c26 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -12051,16 +12051,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({ diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index 28e5c6e1bd2e..e3507f897933 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -11991,16 +11991,19 @@ class GithubUtils { /** * Returns a single artifact by name. If none is found, it returns undefined. */ - static getArtifactByName(artefactName) { + static getArtifactByName(artifactName) { return this.octokit.actions .listArtifactsForRepo({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, per_page: 1, - name: artefactName, + name: artifactName, }) .then((response) => response.data.artifacts[0]); } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ static getArtifactDownloadURL(artifactId) { return this.octokit.actions .downloadArtifact({