Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: script for downloading sourcemaps + symbolicating them #43894

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
397ada7
feat: script for getting uploaded sourcemaps
hannojg Jun 18, 2024
639d89b
finish implementation of download source map step
hannojg Jun 18, 2024
758a861
symbolicate
hannojg Jun 18, 2024
58588b9
fix help command + lint
hannojg Jun 18, 2024
a892234
lint
hannojg Jun 18, 2024
1f48622
fix bugs
hannojg Jun 18, 2024
9fa77dd
simplify fetching artifact by using artifact name
hannojg Jun 19, 2024
a9a31cb
run prettier
hannojg Jun 19, 2024
2ca85c6
Update scripts/symbolicate-profile.ts
hannojg Jun 19, 2024
7016406
Update src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx
hannojg Jun 19, 2024
cf70af8
rename artefact -> artifact
hannojg Jun 20, 2024
4d939c0
Merge branch 'feat/script-for-symbolicating-app-profiles' of github.c…
hannojg Jun 20, 2024
95bdfa8
improve GithubUtils.getArtifactByName to not paginate through all art…
hannojg Jun 20, 2024
e445528
refactor to allow for setup with token + add getArtifactDownloadURL h…
hannojg Jun 20, 2024
9577da0
allow async/await in scripts
hannojg Jun 20, 2024
6896ff1
use GithubUtils
hannojg Jun 20, 2024
33369b9
re=compile gh actions
hannojg Jun 20, 2024
c27a4d2
comment
hannojg Jun 20, 2024
765a77f
setup tsconfig-paths + tsconfig using it in ./scripts to use paths
hannojg Jun 20, 2024
e3229b2
run prettier
hannojg Jun 20, 2024
0aae6f4
use region comments
hannojg Jun 20, 2024
2a717f6
make script executable from any location within the project
hannojg Jun 20, 2024
d35947b
remove unwanted changes
hannojg Jun 20, 2024
742d9d7
ran gh-actions-build
hannojg Jun 20, 2024
eb165d8
add EOF
hannojg Jun 20, 2024
0849924
fix parameter name spelling
hannojg Jun 20, 2024
2942479
jsdoc comment
hannojg Jun 20, 2024
4b70c73
ran gh-actions-build
hannojg Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
*
Expand Down Expand Up @@ -17454,12 +17461,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
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: 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({
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;
Expand Down
44 changes: 35 additions & 9 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
*
Expand Down Expand Up @@ -12695,12 +12702,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
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: 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({
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;
Expand Down
44 changes: 35 additions & 9 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
*
Expand Down Expand Up @@ -11978,12 +11985,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
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: 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({
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;
Expand Down
44 changes: 35 additions & 9 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
*
Expand Down Expand Up @@ -14948,12 +14955,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
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: 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({
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;
Expand Down
44 changes: 35 additions & 9 deletions .github/actions/javascript/getArtifactInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
*
Expand Down Expand Up @@ -11939,12 +11946,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
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: 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({
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;
Expand Down
Loading
Loading