Compare commits

..

No commits in common. "8890d1f140a13a34d772ec4f4038e779cb72713a" and "8a1d3cbf2ec1c6b94ccb8898d8d718042aa524a1" have entirely different histories.

3 changed files with 16 additions and 14 deletions

View File

@ -13,6 +13,7 @@
},
"devDependencies": {
"@types/bun": "latest",
"@types/parse-github-url": "^1.0.3",
"verify-package-export": "^0.0.3"
},
"peerDependencies": {
@ -21,6 +22,7 @@
"dependencies": {
"@huakunshen/jsr-client": "^0.1.5",
"@kksh/api": "workspace:*",
"@octokit/rest": "^21.1.0"
"@octokit/rest": "^21.1.0",
"parse-github-url": "^1.0.3"
}
}

View File

@ -2,6 +2,7 @@
* TODO: move this module to another folder
*/
import { Octokit } from "@octokit/rest"
import gh from "parse-github-url"
/**
* Check if a user is a public member of a GitHub organization
@ -43,14 +44,14 @@ export function parseGitHubRepoFromUri(uri: string): {
owner: string
repo: string
} {
// check regex
const regex = /https?:\/\/github\.com\/([^\/]+)\/([^\/]+)/
const match = uri.match(regex)
if (!match) {
const ghUrl = gh(uri)
if (!ghUrl) {
throw new Error("Invalid GitHub repository URI")
}
const [, owner, repo] = match
return { owner, repo }
if (!ghUrl.owner || !ghUrl.name) {
throw new Error("Invalid GitHub repository URI")
}
return { owner: ghUrl.owner, repo: ghUrl.name }
}
/**

View File

@ -19,7 +19,6 @@
} = $props()
const workflowRunId = githubActionInvocationId.split("/").at(-3)
const workflowRunUrl = `https://github.com/${repoOwner}/${repoName}/actions/runs/${workflowRunId}/workflow`
const giteaMirrorUrl = `https://gitea.kunkun.sh/kunkun-extensions-mirror/${repoOwner}-${repoName}`
</script>
<Card.Root>
@ -61,12 +60,12 @@
class="underline">Transparentcy log entry</a
>
</p>
<p class="flex flex-col text-sm sm:flex-row">
<strong class="mt-2 inline-block w-28 md:mt-0">Mirror</strong>
<a href={giteaMirrorUrl} target="_blank" rel="noreferrer" class="underline">
Mirror Repo
</a>
</p>
<!-- <p class="flex flex-col text-sm sm:flex-row">
<strong class="mt-2 inline-block w-28 md:mt-0">GitLab Mirror</strong>
<a href={gitlabMirrorUrl} target="_blank" rel="noreferrer" class="underline"
>GitLab Mirror</a
>
</p> -->
</div>
</Card.Content>
</Card.Root>