feat(github): add list-repos dynamic data
This commit is contained in:
21
packages/backend/src/apps/github/data/list-repos/index.ts
Normal file
21
packages/backend/src/apps/github/data/list-repos/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import paginateAll from '../../common/paginate-all';
|
||||
|
||||
export default {
|
||||
name: 'List repos',
|
||||
key: 'listRepos',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const firstPageRequest = $.http.get('/user/repos');
|
||||
const response = await paginateAll($, firstPageRequest);
|
||||
|
||||
response.data = response.data.map((repo: { full_name: string }) => {
|
||||
return {
|
||||
value: repo.full_name,
|
||||
name: repo.full_name,
|
||||
};
|
||||
});
|
||||
|
||||
return response;
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user