Apply formatting changes

This commit is contained in:
Jacob Wallraff
2023-01-30 11:29:48 -08:00
parent 64c406e3dc
commit 3f3e3fcb3b
4 changed files with 30 additions and 21 deletions
@@ -92,13 +92,15 @@ async function getRemoteSecrets(
async function fetchSecrets(octokit: Octokit, owner: string, name: string): Promise<StringData[]> {
try {
return await octokit.paginate(octokit.actions.listRepoSecrets,
return await octokit.paginate(
octokit.actions.listRepoSecrets,
{
owner,
repo: name,
per_page: 100
},
response => response.data.map(secret => new StringData(secret.name)));
response => response.data.map(secret => new StringData(secret.name))
);
} catch (e) {
console.log("Failure to retrieve secrets: ", e);
}
@@ -112,13 +114,15 @@ async function fetchEnvironmentSecrets(
environmentName: string
): Promise<StringData[]> {
try {
return await octokit.paginate(octokit.actions.listEnvironmentSecrets,
return await octokit.paginate(
octokit.actions.listEnvironmentSecrets,
{
repository_id: repositoryId,
environment_name: environmentName,
per_page: 100
},
response => response.data.map(secret => new StringData(secret.name)));
response => response.data.map(secret => new StringData(secret.name))
);
} catch (e) {
console.log("Failure to retrieve environment secrets: ", e);
}
@@ -94,15 +94,18 @@ export async function getRemoteVariables(
async function fetchVariables(octokit: Octokit, owner: string, name: string): Promise<Pair[]> {
try {
return await octokit.paginate(octokit.actions.listRepoVariables,
return await octokit.paginate(
octokit.actions.listRepoVariables,
{
owner: owner,
repo: name,
per_page: 100
},
response => response.data.map(variable => {
return {key: variable.name, value: new StringData(variable.value)};
}));
response =>
response.data.map(variable => {
return {key: variable.name, value: new StringData(variable.value)};
})
);
} catch (e) {
console.log("Failure to retrieve variables: ", e);
}
@@ -116,15 +119,18 @@ async function fetchEnvironmentVariables(
environmentName: string
): Promise<Pair[]> {
try {
return await octokit.paginate(octokit.actions.listEnvironmentVariables,
return await octokit.paginate(
octokit.actions.listEnvironmentVariables,
{
repository_id: repositoryId,
environment_name: environmentName,
per_page: 100
},
response => response.data.map(variable => {
return {key: variable.name, value: new StringData(variable.value)};
}));
response =>
response.data.map(variable => {
return {key: variable.name, value: new StringData(variable.value)};
})
);
} catch (e) {
console.log("Failure to retrieve environment variables: ", e);
}
@@ -33,20 +33,19 @@ export async function getRunnerLabels(client: Octokit, cache: TTLCache, owner: s
async function fetchRunnerLabels(client: Octokit, owner: string, name: string): Promise<Set<string>> {
const labels = new Set<string>();
try {
const itor = client.paginate.iterator(client.actions.listSelfHostedRunnersForRepo,
{
owner,
repo: name,
per_page: 100
});
const itor = client.paginate.iterator(client.actions.listSelfHostedRunnersForRepo, {
owner,
repo: name,
per_page: 100
});
for await (const response of itor) {
for await (const response of itor) {
for (const runner of response.data) {
for (const label of runner.labels) {
labels.add(label.name);
}
}
}
}
} catch (e) {
console.log("Failure to retrieve runner labels: ", e);
}
@@ -1,6 +1,6 @@
import {JSONObjectReader} from "../templates/json-object-reader";
import {TemplateSchema} from "../templates/schema";
import WorkflowSchema from "../workflow-v1.0.json" assert { type: 'json' };
import WorkflowSchema from "../workflow-v1.0.json" assert {type: "json"};
let schema: TemplateSchema;