Skip to content

Commit 6ac4cb3

Browse files
committed
refactor: show gist_file_name correctly if not provided
1 parent 68571f6 commit 6ac4cb3

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/run.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@ import { getInput } from './input'
77
export const run = async (): Promise<void> => {
88
const input = getInput()
99

10+
const workSpace = process.env.GITHUB_WORKSPACE!
11+
const filePath = path.join(workSpace, input.filePath)
12+
const fileName = input.gistFileName ?? path.basename(filePath)
13+
1014
startGroup('Dump inputs')
1115
info(`\
1216
[INFO] GistId: ${input.gistId}${
1317
input.gistDescription === undefined
1418
? ''
1519
: `\n[INFO] GistDescription: ${input.gistDescription}`
1620
}
17-
[INFO] GistFileName: ${input.gistFileName ?? 'No Change'}
21+
[INFO] GistFileName: ${fileName}
1822
[INFO] FilePath: ${input.filePath}`)
1923
endGroup()
2024

2125
startGroup('Read file content')
22-
const workSpace = process.env.GITHUB_WORKSPACE!
23-
const filePath = path.join(workSpace, input.filePath)
2426
const content = await fs.readFile(filePath, 'utf-8')
2527
info(`[INFO] Done with file "${filePath}"`)
2628
endGroup()
2729

2830
startGroup('Deploy to gist')
2931
const octokit = getOctokit(input.token)
30-
const fileName = input.gistFileName ?? path.basename(filePath)
3132
await octokit.rest.gists.update({
3233
gist_id: input.gistId,
3334
description: input.gistDescription,

0 commit comments

Comments
 (0)