Skip to content

Commit

Permalink
feat: able to upload files
Browse files Browse the repository at this point in the history
  • Loading branch information
elysia-best authored Dec 13, 2024
1 parent f475ee8 commit 1c421d8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 50 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
remove-old-sources:
description: 'Remove old sources from OBS package'
required: true
default: true
default: 'true'
obs-package-name:
description: 'OBS package name'
required: true
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 11 additions & 23 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.

37 changes: 13 additions & 24 deletions src/obs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,34 +177,23 @@ export class OBSClient {
protected getLocalFileListInDir(dir: string): string[] | null {
try {
// Get realpath of the dir
let real_path: string = dir
fs.realpath(dir, (error, resolvedPath) => {
if (error) {
throw error
} else {
real_path = resolvedPath
}
})
const real_path: string = fs.realpathSync(dir)

const files_list: string[] = []
// Get all files in the dir
fs.readdir(real_path, (err, files) => {
if (err) {
throw err
}
const files_list: string[] = []
const all_files = fs.readdirSync(real_path)

// files object contains all files names
// log them on console
for (const file of files) {
if (
file.includes('dsc') ||
file.includes('changes') ||
file.includes('tar')
) {
files_list.push(`${real_path}/${file}`)
}
// files object contains all files names
// log them on console
for (const file of all_files) {
if (
file.includes('dsc') ||
file.includes('changes') ||
file.includes('tar')
) {
files_list.push(`${real_path}/${file}`)
}
})
}

return files_list
} catch (error) {
Expand Down

0 comments on commit 1c421d8

Please sign in to comment.