Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsadetsky committed May 13, 2024
2 parents ef53378 + 4def321 commit 00dc697
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/commands/github/apps/prune.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Command, Flags} from '@oclif/core'
import {getDisco} from '../../../config.js'
import {request} from '../../../auth-request.js'

export default class GithubAppsPrune extends Command {
static description = 'prune Github apps'

static examples = ['<%= config.bin %> <%= command.id %>']

static flags = {
disco: Flags.string({required: false}),
}

public async run(): Promise<void> {
const {flags} = await this.parse(GithubAppsPrune)
const discoConfig = getDisco(flags.disco || null)
const url = `https://${discoConfig.host}/api/github-apps/prune`
await request({method: 'POST', url, discoConfig, expectedStatuses: [200]})
}
}
9 changes: 7 additions & 2 deletions src/commands/projects/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import {request} from '../../auth-request.js'

interface Project {
name: string
github: {
fullName: string
}
}

export default class ProjectsList extends Command {
Expand All @@ -21,7 +24,9 @@ export default class ProjectsList extends Command {
const discoConfig = getDisco(flags.disco || null)
const url = `https://${discoConfig.host}/api/projects`
const res = await request({method: 'GET', url, discoConfig})
const data = (await res.json()) as any
this.log(data.projects.map((project: Project) => project.name).join('\n'))
const respBody = (await res.json()) as {projects: Project[]}
for (const project of respBody.projects) {
this.log(`${project.name} (${project.github.fullName})`)
}
}
}

0 comments on commit 00dc697

Please sign in to comment.