Skip to content

Commit

Permalink
fix: ignore disabled azure repos from listing
Browse files Browse the repository at this point in the history
  • Loading branch information
novalex committed Nov 15, 2024
1 parent 7c54e54 commit 779232e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lib/source-handlers/azure/list-repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface AzureReposResponse {
name: string;
project: { name: string };
defaultBranch: string;
isDisabled: boolean;
}[];
}
export async function fetchAllRepos(
Expand Down Expand Up @@ -61,9 +62,8 @@ async function getRepos(
Response body: ${JSON.stringify(body)}`);
}
const { value: repos } = body;
repos.map((repo) => {
const { name, project, defaultBranch } = repo;
if (name && project && project.name && defaultBranch) {
repos.map(({ name, project, defaultBranch, isDisabled }) => {
if (name && project && project.name && defaultBranch && !isDisabled) {
repoList.push({
name,
owner: project.name,
Expand Down
2 changes: 1 addition & 1 deletion test/lib/fixtures/azure/org-repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"remoteUrl": "https://dev.azure.com/remoteUrl",
"sshUrl": "",
"webUrl": "https://dev.azure.com/remoteUrl",
"isDisabled": false
"isDisabled": true
}
],
"count": 3
Expand Down
2 changes: 1 addition & 1 deletion test/lib/source-handlers/azure/azure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Testing azure-devops interaction', () => {
});
test('Test listAzureRepos with one page', async () => {
const repos = await listAzureRepos('reposTestOrg', 'https://azure-tests');
expect(repos).toHaveLength(3);
expect(repos).toHaveLength(2);
});
test('listAzureRepos to fail', async () => {
expect(async () => {
Expand Down

0 comments on commit 779232e

Please sign in to comment.