Skip to content

Commit

Permalink
Include all commit info in GitInfo and reorder the fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Aug 23, 2023
1 parent 308fbec commit 664ba9d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions node-src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,34 @@ export async function runAll(ctx, options?: Options) {
}

export type GitInfo = {
userEmail: string;
userEmailHash: string;
slug: string;
branch: string;
commit: string;
slug: string;
committedAt: number;
committerEmail: string;
committerName: string;
uncommittedHash: string;
userEmail: string;
userEmailHash: string;
};

export async function getGitInfo(): Promise<GitInfo> {
const slug = await getSlug();
const branch = await getBranch();
const commitInfo = await getCommit();
const userEmail = await getUserEmail();
const userEmailHash = emailHash(userEmail);
const branch = await getBranch();
const { commit } = await getCommit();
const slug = await getSlug();

const [ownerName, repoName, ...rest] = slug ? slug.split('/') : [];
const isValidSlug = !!ownerName && !!repoName && !rest.length;

const uncommittedHash = await getUncommittedHash();
return {
userEmail,
userEmailHash,
branch,
commit,
slug: isValidSlug ? slug : '',
branch,
...commitInfo,
uncommittedHash,
userEmail,
userEmailHash,
};
}

0 comments on commit 664ba9d

Please sign in to comment.