event.ts
This file
Path
apps/platform/src/workflows/on-push/event.ts
40 lines · 1.0 KiB · TypeScript
Last changed by
Merge build/comments-platform into mainoscabrielbefore adoptionddf09e8
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738394041import { CommitSha, RepoName } from "@repo/protocol/ids";import { Schema } from "effect";
const GitIdentity = Schema.Struct({ email: Schema.String, name: Schema.String,});
const PushedCommit = Schema.Struct({ author: GitIdentity, committer: GitIdentity, id: CommitSha, message: Schema.String, messageTruncated: Schema.Boolean, parents: Schema.Array(CommitSha), timestamp: Schema.DateTimeUtcFromString,});
export const OnPushEvent = Schema.Struct({ id: Schema.NonEmptyString, payload: Schema.Struct({ after: CommitSha, before: CommitSha, commits: Schema.Array(PushedCommit), commitsTruncated: Schema.Boolean, ref: Schema.NonEmptyString, totalCommitsCount: Schema.Int, }), source: Schema.Struct({ namespace: Schema.NonEmptyString, repoName: RepoName, }), type: Schema.Literal("cf.artifacts.repo.pushed"),});
export type OnPushEvent = typeof OnPushEvent.Type;
export const ZeroSha = CommitSha.make("0".repeat(40));
export const isZero = (sha: CommitSha): boolean => sha === ZeroSha;