@@ -8,6 +8,7 @@ import { createTempDirectory } from './utils'
8
8
9
9
export const run = async ( ) : Promise < void > => {
10
10
const input = getInput ( )
11
+ const { token, gistId, gistDescription } = input
11
12
12
13
const workspace = process . env . GITHUB_WORKSPACE !
13
14
const filePath = join ( workspace , input . filePath )
@@ -17,8 +18,8 @@ export const run = async (): Promise<void> => {
17
18
18
19
startGroup ( 'Dump inputs' )
19
20
info ( `\
20
- [INFO] GistId: ${ input . gistId } ${
21
- input . gistDescription === undefined ? '' : `\n[INFO] GistDescription: ${ input . gistDescription } `
21
+ [INFO] GistId: ${ gistId } ${
22
+ gistDescription === undefined ? '' : `\n[INFO] GistDescription: ${ gistDescription } `
22
23
}
23
24
[INFO] GistFileName: ${ fileName }
24
25
[INFO] FilePath: ${ input . filePath }
@@ -28,10 +29,10 @@ export const run = async (): Promise<void> => {
28
29
startGroup ( 'Deploy to gist' )
29
30
if ( fileType === 'text' ) {
30
31
const content = await fs . readFile ( filePath , 'utf-8' )
31
- const octokit = getOctokit ( input . token )
32
+ const octokit = getOctokit ( token )
32
33
await octokit . rest . gists . update ( {
33
- gist_id : input . gistId ,
34
- description : input . gistDescription ,
34
+ gist_id : gistId ,
35
+ description : gistDescription ,
35
36
files : {
36
37
[ fileName ] : {
37
38
fileName,
@@ -42,7 +43,7 @@ export const run = async (): Promise<void> => {
42
43
} else {
43
44
const git = simpleGit ( )
44
45
const gistDir = await createTempDirectory ( )
45
- await git . clone ( `https://${ input . token } @gist.github.com/${ input . gistId } .git` , gistDir )
46
+ await git . clone ( `https://${ token } @gist.github.com/${ gistId } .git` , gistDir )
46
47
await git . cwd ( gistDir )
47
48
await git . addConfig ( 'user.name' , process . env . GITHUB_ACTOR ! )
48
49
await git . addConfig ( 'user.email' , `${ process . env . GITHUB_ACTOR } @users.noreply.github.com` )
@@ -52,7 +53,7 @@ export const run = async (): Promise<void> => {
52
53
const branch = await git . revparse ( [ '--abbrev-ref' , 'HEAD' ] )
53
54
await git . push ( 'origin' , branch )
54
55
}
55
- info ( `[INFO] Done with gist "${ input . gistId } /${ fileName } "` )
56
+ info ( `[INFO] Done with gist "${ gistId } /${ fileName } "` )
56
57
endGroup ( )
57
58
58
59
info ( '[INFO] Action successfully completed' )
0 commit comments