Skip to content

Commit

Permalink
Typescript error (#111)
Browse files Browse the repository at this point in the history
added typescript definition

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
levelingup and github-actions[bot] authored Feb 16, 2024
1 parent f870a44 commit 9ff4916
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_TOKEN }}
event-type: build-event
event-type: build-event
20 changes: 17 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ interface IRepo {
owner: string;
}

interface RepoInfo {
name: string;
owner: {
login: string;
};
isFork: boolean;
}

interface Edge {
node: {
committedDate: string;
};
}

(async () => {
/**
* First, get user id
Expand All @@ -37,8 +51,8 @@ interface IRepo {
);
const repos: IRepo[] =
repoResponse?.data?.user?.repositoriesContributedTo?.nodes
.filter(repoInfo => !repoInfo?.isFork)
.map(repoInfo => ({
.filter((repoInfo: RepoInfo) => !repoInfo?.isFork)
.map((repoInfo: RepoInfo) => ({
name: repoInfo?.name,
owner: repoInfo?.owner?.login,
}));
Expand All @@ -61,7 +75,7 @@ interface IRepo {

committedTimeResponseMap.forEach(committedTimeResponse => {
committedTimeResponse?.data?.repository?.defaultBranchRef?.target?.history?.edges.forEach(
edge => {
(edge: Edge) => {
const committedDate = edge?.node?.committedDate;
const timeString = new Date(committedDate).toLocaleTimeString('en-US', {
hour12: false,
Expand Down

0 comments on commit 9ff4916

Please sign in to comment.