Skip to content

Commit 89889e0

Browse files
authored
Merge pull request #497 from snyk/fix/azure-repos-ignore-disabled
fix: ignore disabled azure repos from listing
2 parents 7c54e54 + 0afee01 commit 89889e0

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/lib/source-handlers/azure/list-repos.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface AzureReposResponse {
1515
name: string;
1616
project: { name: string };
1717
defaultBranch: string;
18+
isDisabled: boolean;
1819
}[];
1920
}
2021
export async function fetchAllRepos(
@@ -61,9 +62,8 @@ async function getRepos(
6162
Response body: ${JSON.stringify(body)}`);
6263
}
6364
const { value: repos } = body;
64-
repos.map((repo) => {
65-
const { name, project, defaultBranch } = repo;
66-
if (name && project && project.name && defaultBranch) {
65+
repos.map(({ name, project, defaultBranch, isDisabled }) => {
66+
if (name && project && project.name && defaultBranch && !isDisabled) {
6767
repoList.push({
6868
name,
6969
owner: project.name,

test/lib/fixtures/azure/org-repos.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"remoteUrl": "https://dev.azure.com/remoteUrl",
5959
"sshUrl": "",
6060
"webUrl": "https://dev.azure.com/remoteUrl",
61-
"isDisabled": false
61+
"isDisabled": true
6262
}
6363
],
6464
"count": 3

test/lib/source-handlers/azure/azure.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Testing azure-devops interaction', () => {
7070
});
7171
test('Test listAzureRepos with one page', async () => {
7272
const repos = await listAzureRepos('reposTestOrg', 'https://azure-tests');
73-
expect(repos).toHaveLength(3);
73+
expect(repos).toHaveLength(2);
7474
});
7575
test('listAzureRepos to fail', async () => {
7676
expect(async () => {

test/system/orgs:data/gitlab.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('General `snyk-api-import orgs:data <...>`', () => {
2626
expect(stderr).toEqual('');
2727
expect(err).toBeNull();
2828
expect(stdout).toMatch(
29-
'Found 7 group(s). Written the data to file: group-hello-gitlab-orgs.json',
29+
'Found 9 group(s). Written the data to file: group-hello-gitlab-orgs.json',
3030
);
3131
deleteFiles([
3232
path.resolve(__dirname, `group-${groupId}-gitlab-orgs.json`),

0 commit comments

Comments
 (0)