Retrieve every page of secrets
This commit is contained in:
@@ -92,12 +92,13 @@ async function getRemoteSecrets(
|
||||
|
||||
async function fetchSecrets(octokit: Octokit, owner: string, name: string): Promise<StringData[]> {
|
||||
try {
|
||||
const response = await octokit.actions.listRepoSecrets({
|
||||
owner,
|
||||
repo: name
|
||||
});
|
||||
|
||||
return response.data.secrets.map(secret => new StringData(secret.name));
|
||||
return await octokit.paginate(octokit.actions.listRepoSecrets,
|
||||
{
|
||||
owner,
|
||||
repo: name,
|
||||
per_page: 100
|
||||
},
|
||||
response => response.data.map(secret => new StringData(secret.name)));
|
||||
} catch (e) {
|
||||
console.log("Failure to retrieve secrets: ", e);
|
||||
}
|
||||
@@ -111,12 +112,13 @@ async function fetchEnvironmentSecrets(
|
||||
environmentName: string
|
||||
): Promise<StringData[]> {
|
||||
try {
|
||||
const response = await octokit.actions.listEnvironmentSecrets({
|
||||
repository_id: repositoryId,
|
||||
environment_name: environmentName
|
||||
});
|
||||
|
||||
return response.data.secrets.map(secret => new StringData(secret.name));
|
||||
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)));
|
||||
} catch (e) {
|
||||
console.log("Failure to retrieve environment secrets: ", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user