Skip to content

Commit

Permalink
5.1.1 (#18)
Browse files Browse the repository at this point in the history
* build: use diskusage npm package instead

* build: include calc-repo-size in tsconfig.json
  • Loading branch information
piquark6046 authored Dec 13, 2023
1 parent 95e52b0 commit d60e520
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions calc-repo-size/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as GitHub from '@octokit/rest'
import * as Actions from '@actions/core'
import * as Commander from 'commander'
import checkDiskSpace from 'check-disk-space'
import * as DiskUsage from 'diskusage'

const Program = new Commander.Command()

Expand All @@ -27,7 +27,7 @@ const ProgramOptions: ProgramOptionsType = Program.opts()
const GitHubInstance = new GitHub.Octokit({auth: ProgramOptions.ghToken})
const RepoSize = GitHubInstance.repos.get({owner: ProgramOptions.repo.split('/')[0], repo: ProgramOptions.repo.split('/')[1]})
.then(Response => Response.data.size)
const DiskFreeSize = checkDiskSpace(ProgramOptions.ciWorkspacePath).then(DiskInfo => DiskInfo.free)
const DiskFreeSize = DiskUsage.check(ProgramOptions.ciWorkspacePath).then(DiskInfo => DiskInfo.available)

await Promise.all([RepoSize, DiskFreeSize]).then(([RepoSizeVaule, DiskFreeSizeVaule]) => {
Actions.info(`calc-repo-size: RepoSize: ${RepoSizeVaule}; DiskFreeSize: ${DiskFreeSizeVaule}`)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"@octokit/rest": "^20.0.2",
"@types/luxon": "^3.3.7",
"@types/node": "^20.10.4",
"check-disk-space": "^3.4.0",
"commander": "^11.1.0",
"diskusage": "^1.2.0",
"got": "^14.0.0",
"luxon": "^3.4.4",
"p-queue": "^8.0.0",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"include": [
"index.ts",
"sources/**/*.ts"
"sources/**/*.ts",
"calc-repo-size/**/*.ts"
]
}

0 comments on commit d60e520

Please sign in to comment.