File tree 2 files changed +7
-22
lines changed 2 files changed +7
-22
lines changed Original file line number Diff line number Diff line change 133
133
const installationToken = resp.token;
134
134
// Need to check accessibility if scope set repository
135
135
if (scope !== '' && scope.split('/').length === 2) {
136
- const error = yield isExistRepositoryInGitHubApps(
137
- installationToken,
138
- scope
139
- );
140
- if (error.error !== '') {
141
- throw new Error(error.error);
142
- }
136
+ yield isExistRepositoryInGitHubApps(installationToken, scope);
143
137
}
144
138
core.setSecret(installationToken);
145
139
core.setOutput('token', installationToken);
162
156
(item) => item.full_name === repository
163
157
);
164
158
if (repo === undefined) {
165
- return {
166
- error: `GitHub Apps can't accessible repository (${repository})`,
167
- } ;
159
+ throw new Error(
160
+ `GitHub Apps can't accessible repository (${repository})`
161
+ ) ;
168
162
}
169
- return {error: ''};
170
163
});
171
164
}
172
165
run();
Original file line number Diff line number Diff line change @@ -51,13 +51,7 @@ async function run(): Promise<void> {
51
51
52
52
// Need to check accessibility if scope set repository
53
53
if ( scope !== '' && scope . split ( '/' ) . length === 2 ) {
54
- const error = await isExistRepositoryInGitHubApps (
55
- installationToken ,
56
- scope
57
- ) ;
58
- if ( error . error !== '' ) {
59
- throw new Error ( error . error ) ;
60
- }
54
+ await isExistRepositoryInGitHubApps ( installationToken , scope ) ;
61
55
}
62
56
63
57
core . setSecret ( installationToken ) ;
@@ -72,7 +66,7 @@ async function run(): Promise<void> {
72
66
async function isExistRepositoryInGitHubApps (
73
67
installationToken : string ,
74
68
repository : string
75
- ) : Promise < { error : string } > {
69
+ ) : Promise < void > {
76
70
const installationOctokit = new Octokit ( {
77
71
auth : installationToken ,
78
72
baseUrl : process . env . GITHUB_API_URL || 'https://api.github.com' ,
@@ -84,10 +78,8 @@ async function isExistRepositoryInGitHubApps(
84
78
( item ) => item . full_name === repository
85
79
) ;
86
80
if ( repo === undefined ) {
87
- return { error : `GitHub Apps can't accessible repository (${ repository } )` } ;
81
+ throw new Error ( `GitHub Apps can't accessible repository (${ repository } )` ) ;
88
82
}
89
-
90
- return { error : '' } ;
91
83
}
92
84
93
85
run ( ) ;
You can’t perform that action at this time.
0 commit comments