Fix errors and complete v1 full-loop of GitHub integration with repository secrets

This commit is contained in:
Tuan Dang
2022-12-21 23:15:22 -05:00
parent 54b0285cbd
commit 7763e33de6
11 changed files with 119 additions and 155 deletions
+13 -5
View File
@@ -13,6 +13,10 @@ import {
INTEGRATION_GITHUB_API_URL
} from '../variables';
interface GitHubApp {
name: string;
}
/**
* Return list of names of apps for integration named [integration]
* @param {Object} obj
@@ -186,13 +190,17 @@ const getAppsGithub = async ({
auth: accessToken
});
const repos = await octokit.request(
const repos = (await octokit.request(
'GET /user/repos{?visibility,affiliation,type,sort,direction,per_page,page,since,before}',
{}
);
apps = repos.map((a: any) => {
a.name;
});
)).data;
apps = repos
.filter((a:any) => a.permissions.admin === true)
.map((a: any) => ({
name: a.name
})
);
} catch (err) {
Sentry.setUser(null);
Sentry.captureException(err);