feat: add post-run Gitea lifecycle (#5)

This commit is contained in:
-Puter
2026-07-24 02:05:30 +05:30
parent 7974bd5f3e
commit a17d53cb41
16 changed files with 1281 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ import {
ExternalLink,
FileText,
GitFork,
GitPullRequest,
Play,
Plus,
} from "lucide-react";
@@ -139,7 +140,9 @@ interface ArtifactGridProps {
const renderArtifacts = (artifacts: ArtifactGridProps["artifacts"]) => {
if (artifacts === undefined) {
return <p className="text-xs text-muted-foreground">Loading artifacts...</p>;
return (
<p className="text-xs text-muted-foreground">Loading artifacts...</p>
);
}
if (artifacts.length === 0) {
return <p className="text-xs text-muted-foreground">No artifacts yet.</p>;
@@ -168,6 +171,55 @@ const ArtifactGrid = ({ artifacts }: ArtifactGridProps) => (
</section>
);
interface PullRequestPanelProps {
readonly pullRequest:
| {
readonly baseBranch: string;
readonly branch: string;
readonly number: number;
readonly status: "open" | "closed" | "merged";
readonly url: string;
}
| undefined;
}
const PullRequestPanel = ({ pullRequest }: PullRequestPanelProps) => {
if (!pullRequest) {
return null;
}
return (
<section aria-labelledby="pull-request-heading" className="space-y-3">
<div className="flex items-center gap-2">
<GitPullRequest className="size-4 text-muted-foreground" />
<h2 id="pull-request-heading" className="text-sm font-semibold">
Pull request
</h2>
</div>
<div className="border p-3">
<div className="flex flex-wrap items-center justify-between gap-2">
<a
className="text-sm font-medium underline underline-offset-4"
href={pullRequest.url}
rel="noreferrer"
target="_blank"
>
#{pullRequest.number}
</a>
<span className="border border-emerald-500/40 bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-300">
{pullRequest.status}
</span>
</div>
<p className="mt-2 text-xs text-muted-foreground">
{pullRequest.branch} {pullRequest.baseBranch}
</p>
<p className="mt-1 text-xs text-muted-foreground">
Merge remains manual.
</p>
</div>
</section>
);
};
interface IssueComposerProps {
readonly body: string;
readonly busy: boolean;
@@ -354,6 +406,8 @@ export const ProjectWorkspacePage = () => {
<ArtifactGrid artifacts={workspace.artifacts} />
<PullRequestPanel pullRequest={workspace.pullRequest} />
<div className="grid items-start gap-5 lg:grid-cols-[minmax(280px,380px)_1fr]">
<IssueComposer
body={workspace.issueBody}

View File

@@ -33,6 +33,30 @@ export const useProjectWorkspace = () => {
api.projectIssues.list,
activeProjectId ? { projectId: activeProjectId } : "skip"
);
const events = useQuery(
api.projectIssues.events,
activeProjectId ? { projectId: activeProjectId } : "skip"
);
const pullRequest = events
?.map((event) => event.data)
.find(
(
data
): data is {
pullRequest: {
baseBranch: string;
branch: string;
number: number;
status: "open" | "closed" | "merged";
url: string;
};
} =>
typeof data === "object" &&
data !== null &&
"pullRequest" in data &&
typeof data.pullRequest === "object" &&
data.pullRequest !== null
)?.pullRequest;
const connectRepository = async () => {
setPendingAction("connect");
@@ -99,11 +123,13 @@ export const useProjectWorkspace = () => {
artifacts,
connectRepository,
error,
events,
issueBody,
issueTitle,
issues,
pendingAction,
projects,
pullRequest,
raiseIssue,
repository,
selectedProject,