update env secret and vars parameters

This commit is contained in:
Anthony Zavala
2025-05-07 19:43:30 +00:00
parent 80c99e6e38
commit e597a0c800
2 changed files with 10 additions and 6 deletions
@@ -125,7 +125,7 @@ async function getRemoteSecrets(
environmentSecrets: environmentSecrets:
(environmentName && (environmentName &&
(await cache.get(`${repo.owner}/${repo.name}/secrets/environment/${environmentName}`, undefined, () => (await cache.get(`${repo.owner}/${repo.name}/secrets/environment/${environmentName}`, undefined, () =>
fetchEnvironmentSecrets(octokit, repo.id, environmentName) fetchEnvironmentSecrets(octokit, repo.owner, repo.name, environmentName)
))) || ))) ||
[], [],
orgSecrets: await cache.get(`${repo.owner}/secrets`, undefined, () => fetchOrganizationSecrets(octokit, repo)) orgSecrets: await cache.get(`${repo.owner}/secrets`, undefined, () => fetchOrganizationSecrets(octokit, repo))
@@ -151,14 +151,16 @@ async function fetchSecrets(octokit: Octokit, owner: string, name: string): Prom
async function fetchEnvironmentSecrets( async function fetchEnvironmentSecrets(
octokit: Octokit, octokit: Octokit,
repositoryId: number, owner: string,
name: string,
environmentName: string environmentName: string
): Promise<StringData[]> { ): Promise<StringData[]> {
try { try {
return await octokit.paginate( return await octokit.paginate(
octokit.actions.listEnvironmentSecrets, octokit.actions.listEnvironmentSecrets,
{ {
repository_id: repositoryId, owner,
repo: name,
environment_name: environmentName, environment_name: environmentName,
per_page: 100 per_page: 100
}, },
@@ -115,7 +115,7 @@ export async function getRemoteVariables(
environmentVariables: environmentVariables:
(environmentName && (environmentName &&
(await cache.get(`${repo.owner}/${repo.name}/vars/environment/${environmentName}`, undefined, () => (await cache.get(`${repo.owner}/${repo.name}/vars/environment/${environmentName}`, undefined, () =>
fetchEnvironmentVariables(octokit, repo.id, environmentName) fetchEnvironmentVariables(octokit, repo.owner, repo.name, environmentName)
))) || ))) ||
[], [],
organizationVariables: await cache.get(`${repo.owner}/vars`, undefined, () => organizationVariables: await cache.get(`${repo.owner}/vars`, undefined, () =>
@@ -146,14 +146,16 @@ async function fetchVariables(octokit: Octokit, owner: string, name: string): Pr
async function fetchEnvironmentVariables( async function fetchEnvironmentVariables(
octokit: Octokit, octokit: Octokit,
repositoryId: number, owner: string,
name: string,
environmentName: string environmentName: string
): Promise<Pair[]> { ): Promise<Pair[]> {
try { try {
return await octokit.paginate( return await octokit.paginate(
octokit.actions.listEnvironmentVariables, octokit.actions.listEnvironmentVariables,
{ {
repository_id: repositoryId, owner: owner,
repo: name,
environment_name: environmentName, environment_name: environmentName,
per_page: 100 per_page: 100
}, },