code: nextjs,frontends,workflow (4 files)

This commit is contained in:
2025-12-25 22:49:41 +00:00
parent ac5bd1d4b0
commit a9cc6f4754
4 changed files with 48 additions and 3 deletions

View File

@@ -25,9 +25,6 @@ import {
CheckCircle,
Warning,
Image as ImageIcon,
FilmStrip,
MusicNote,
FileText
} from '@phosphor-icons/react'
interface PackageImportExportProps {

View File

@@ -0,0 +1,17 @@
import type { Octokit } from 'octokit'
export async function listWorkflowRunJobs(options: {
client: Octokit
owner: string
repo: string
runId: number
}) {
const { data } = await options.client.rest.actions.listJobsForWorkflowRun({
owner: options.owner,
repo: options.repo,
run_id: options.runId,
per_page: 100,
})
return data.jobs
}

View File

@@ -0,0 +1,16 @@
import type { Octokit } from 'octokit'
export async function listWorkflowRuns(options: {
client: Octokit
owner: string
repo: string
perPage: number
}) {
const { data } = await options.client.rest.actions.listWorkflowRunsForRepo({
owner: options.owner,
repo: options.repo,
per_page: options.perPage,
})
return data.workflow_runs
}

View File

@@ -0,0 +1,15 @@
export function resolveGitHubRepo(params: URLSearchParams) {
const ownerParam = params.get('owner')
const repoParam = params.get('repo')
const owner = (ownerParam && ownerParam.trim()) || process.env.GITHUB_OWNER || 'johndoe6345789'
const repo = (repoParam && repoParam.trim()) || process.env.GITHUB_REPO || 'metabuilder'
const slugPattern = /^[A-Za-z0-9_.-]+$/
if (!slugPattern.test(owner) || !slugPattern.test(repo)) {
const error = new Error('Invalid GitHub repository owner or repo')
;(error as Error & { status?: number }).status = 400
throw error
}
return { owner, repo }
}