Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
jackalcooper committed Jul 2, 2024
1 parent 511a9c2 commit da4b18b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('action', () => {
4,
'lfs_url',
expect.stringMatching(
/https:\/huggingface.co\/J5Tsai\/debug-static-files\/resolve\/.+\/sd3demo.jpg/
/https:\/\/huggingface.co\/J5Tsai\/debug-static-files\/resolve\/.+\/sd3demo.jpg/
)
)
expect(errorMock).not.toHaveBeenCalled()
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ async function list(): Promise<void> {
const repoDir: string = core.getInput('repo-dir')
const repoRef: string = core.getInput('repo-ref')
const remotes = await git.listRemotes({ fs, dir: repoDir })
const remote_url: string = (remotes[0].url as string).replace(
'https:/huggingface.co',
'https://huggingface.co'
)
const remote_url: string = remotes[0].url as string
const commits = await git.log({ fs, dir: repoDir, depth: 5, ref: repoRef })
const headRef = commits[0].oid

Expand All @@ -79,7 +76,7 @@ async function list(): Promise<void> {
const content: string = fs.readFileSync(path.join(repoDir, f), 'utf-8')
if (content.includes('version https://git-lfs.github.com/spec/')) {
core.setOutput('lfs', f)
const src_url = path.join(remote_url, 'resolve', headRef, f)
const src_url = `${remote_url}/resolve/${headRef}/${f}`
core.setOutput('lfs_url', src_url)
tasks.push(src_url)
} else {
Expand Down

0 comments on commit da4b18b

Please sign in to comment.