11import { GitHub } from '@actions/github' ;
2- import * as TaskEither from 'fp-ts/lib/TaskEither' ;
3- import * as IOEither from 'fp-ts/lib/IOEither' ;
4- import * as Either from 'fp-ts/lib/Either' ;
2+ import * as TE from 'fp-ts/lib/TaskEither' ;
3+ import * as E from 'fp-ts/lib/Either' ;
54import { pipe } from 'fp-ts/lib/pipeable' ;
65import { ChecksCreateResponse , ChecksUpdateParamsOutputAnnotations , ChecksUpdateParams , Response } from '@octokit/rest' ;
76
@@ -14,30 +13,29 @@ type Event = {
1413 } ;
1514} ;
1615
17- export const createOctokitInstance = ( token : string ) =>
18- TaskEither . fromIOEither ( IOEither . tryCatch ( ( ) => new GitHub ( token ) , Either . toError ) ) ;
16+ export const createOctokitInstance = ( token : string ) => TE . fromEither ( E . tryCatch ( ( ) => new GitHub ( token ) , E . toError ) ) ;
1917
2018export const createGithubCheck = (
2119 octokit : GitHub ,
2220 event : { owner : string ; repo : string } ,
2321 name : string ,
2422 head_sha : string
2523) =>
26- TaskEither . tryCatch (
24+ TE . tryCatch (
2725 ( ) =>
2826 octokit . checks . create ( {
2927 owner : event . owner ,
3028 repo : event . repo ,
3129 name,
3230 head_sha,
3331 } ) ,
34- Either . toError
32+ E . toError
3533 ) ;
3634
3735export const getRepositoryInfoFromEvent = ( eventPath : string ) =>
3836 pipe (
39- TaskEither . fromIOEither ( IOEither . tryCatch < Error , Event > ( ( ) => require ( eventPath ) , Either . toError ) ) ,
40- TaskEither . map ( event => {
37+ TE . fromEither ( E . tryCatch < Error , Event > ( ( ) => require ( eventPath ) , E . toError ) ) ,
38+ TE . map ( event => {
4139 const { repository } = event ;
4240 const {
4341 owner : { login : owner } ,
@@ -56,7 +54,7 @@ export const updateGithubCheck = (
5654 conclusion : ChecksUpdateParams [ 'conclusion' ] ,
5755 message ?: string
5856) =>
59- TaskEither . tryCatch (
57+ TE . tryCatch (
6058 ( ) =>
6159 octokit . checks . update ( {
6260 check_run_id : check . data . id ,
@@ -76,5 +74,5 @@ export const updateGithubCheck = (
7674 annotations,
7775 } ,
7876 } ) ,
79- Either . toError
77+ E . toError
8078 ) ;
0 commit comments