kunkun/packages/ui/src/components/extension/GitHubProvenanceCard.svelte
Huakun 9fe51f6260
Feat: gitea mirror (#262)
* Update component props and add GitLab link

- Made `ref` prop optional in TauriLink component
- Added GitLab mirror URL to GitHubProvenanceCard
- Included a link to the GitLab mirror in the card layout
- Adjusted layout for StoreExtDetail component for better responsiveness
- Imported Tooltip component for potential future use

* chore: add parse-github-url dependency and update GitHub parsing logic

- Added `parse-github-url` package as a dependency in `package.json`.
- Updated `parseGitHubRepoFromUri` function to utilize `parse-github-url` for improved URI parsing.
- Introduced `getGitHubRepoMetadata` function to fetch repository metadata using Octokit.
- Updated validation data structure to include optional `repoId`.
- Enhanced tests to cover new functionality and error handling for invalid URIs.

* fix typo

* refactor: update validation data structure and improve function documentation

- Removed optional `repoId` from `ExtensionPublishValidationData` and adjusted related function to reflect this change.
- Added a note in the `validateJsrPackageAsKunkunExtension` function documentation to clarify frontend/backend verification logic.
- Updated `ExtPublishMetadata` to rename `repoId` to `repoNodeId` for clarity.

* refactor: remove GitLab mirror link from GitHubProvenanceCard

- Removed the GitLab mirror URL and its associated link from the GitHubProvenanceCard component.
- Commented out the layout for the GitLab mirror instead of deleting it, preserving the structure for potential future use.

* refactor: simplify GitHub repository URI parsing

- Removed dependency on `parse-github-url` and implemented a regex-based approach for parsing GitHub repository URIs in the `parseGitHubRepoFromUri` function.
- Enhanced error handling for invalid URIs while maintaining the function's output structure.

* feat: add Gitea mirror link to GitHubProvenanceCard

- Introduced a new link to the Gitea mirror repository in the GitHubProvenanceCard component.
- Updated the layout to reflect the new mirror link while removing the commented-out GitLab mirror section.

* refactor: enhance Globe component's location handling

- Updated the Globe component to conditionally render markers based on the provided locations prop.
- Simplified the destructuring of props for better readability.
- Retained default marker locations for cases where no locations are provided.

* pnpm lock
2025-03-26 01:08:16 -04:00

73 lines
2.3 KiB
Svelte

<script lang="ts">
import { Card } from "@kksh/svelte5"
import { BadgeCheckIcon } from "lucide-svelte"
let {
repoOwner,
repoName,
githubActionInvocationId,
commit,
rekorLogIndex,
workflowPath
}: {
repoOwner: string
repoName: string
githubActionInvocationId: string
commit: string
rekorLogIndex: string
workflowPath: string
} = $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>
<Card.Content class="flex flex-col items-center justify-between space-x-4 md:flex-row">
<div class="flex w-60 items-center space-x-4">
<BadgeCheckIcon class="h-8 w-8 text-green-500" />
<div>
<span class="text-sm text-gray-800 dark:text-gray-200">Built and signed on</span>
<h1 class="text-xl font-bold">GitHub Actions</h1>
<a href={githubActionInvocationId} class="text-sm underline" target="_blank">
View build summary
</a>
</div>
</div>
<div>
<p class="flex flex-col text-sm sm:flex-row">
<strong class="mt-2 inline-block w-28 md:mt-0">Source Commit</strong>
<a
href={`https://github.com/${repoOwner}/${repoName}/tree/${commit}`}
target="_blank"
rel="noreferrer"
class="font-mono underline"
>
github.com/{repoOwner}/{repoName}/{commit.slice(0, 8)}
</a>
</p>
<p class="flex flex-col text-sm sm:flex-row">
<strong class="mt-2 inline-block w-28 md:mt-0">Build File</strong>
<a href={workflowRunUrl} target="_blank" rel="noreferrer" class="font-mono underline">
{workflowPath}
</a>
</p>
<p class="flex flex-col text-sm sm:flex-row">
<strong class="mt-2 inline-block w-28 md:mt-0">Public Ledger</strong>
<a
href={`https://search.sigstore.dev/?logIndex=${rekorLogIndex}`}
target="_blank"
rel="noreferrer"
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>
</div>
</Card.Content>
</Card.Root>