diff --git a/README.md b/README.md index e4cf5de..6076825 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A Github Action that can sync secrets from one repository to many others. This a ### `repositories` -**Required** New line deliminated regex expressions to select repositories. Repositires are limited to those in whcich the token user is an owner or collaborator. Set `repositories_list_regex` to `False` to use a hardcoded list of repositories. +**Required** New line deliminated regex expressions to select repositories. Repositires are limited to those in whcich the token user is an owner or collaborator. Set `repositories_list_regex` to `False` to use a hardcoded list of repositories. Archived repositories will be ignored. ### `repositories_list_regex` diff --git a/__tests__/github.test.ts b/__tests__/github.test.ts index d896e0b..c05ae11 100644 --- a/__tests__/github.test.ts +++ b/__tests__/github.test.ts @@ -51,11 +51,15 @@ afterAll(() => { }); describe("listing repos from github", () => { - const pageSize = 2; + const pageSize = 3; beforeEach(() => { nock("https://api.github.com") .get(/\/user\/repos?.*page=1.*/) - .reply(200, [fixture[0].response, fixture[0].response]); + .reply(200, [ + fixture[0].response, + fixture[0].response, + { archived: true, full_name: "foo/bar" } + ]); nock("https://api.github.com") .get(/\/user\/repos?.*page=2.*/) diff --git a/action.yml b/action.yml index 8403971..c85ea49 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,7 @@ inputs: New line deliminated regex expressions to select repositories. Repositires are limited to those in which the token user is an owner or collaborator. Set `REPOSITORIES_LIST_REGEX` to `False` to use a hardcoded list of - repositories. + repositories. Archived repositories will be ignored. required: true repositories_list_regex: default: "true" diff --git a/dist/index.js b/dist/index.js index 899a578..3d8c3c9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7577,7 +7577,7 @@ function listAllReposForAuthenticatedUser({ octokit, affiliation, pageSize }) { break; } } - return repos; + return repos.filter(r => !r.archived); }); } exports.listAllReposForAuthenticatedUser = listAllReposForAuthenticatedUser; diff --git a/src/github.ts b/src/github.ts index bab949d..9962177 100644 --- a/src/github.ts +++ b/src/github.ts @@ -23,6 +23,7 @@ import { retry } from "@octokit/plugin-retry"; export interface Repository { full_name: string; + archived?: boolean; } export interface PublicKey { @@ -124,7 +125,7 @@ export async function listAllReposForAuthenticatedUser({ break; } } - return repos; + return repos.filter(r => !r.archived); } export function filterReposByPatterns(