Skip to content

Commit

Permalink
Update Badge.yml
Browse files Browse the repository at this point in the history
Update Badge.yml
  • Loading branch information
farag2 committed Sep 24, 2023
1 parent 68b9137 commit 8595c44
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions .github/workflows/Badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,12 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@main

- name: Download cloc
run: |
$Token = "${{ secrets.GITHUB_TOKEN }}"
$Headers = @{
Accept = "application/json"
Authorization = "Bearer $Token"
}
$Parameters = @{
Uri = "https://api.github.com/repos/AlDanial/cloc/releases/latest"
Headers = $Headers
UseBasicParsing = $true
Verbose = $true
}
$Tag = (Invoke-RestMethod @Parameters).tag_name.replace("v", "")
$Parameters = @{
Uri = "https://github.com/AlDanial/cloc/releases/download/v$Tag/cloc-$Tag.exe"
OutFile = "$PSScriptRoot\cloc.exe"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
- name: Get the Numbers
run: |
$JSON = & "$PSScriptRoot\cloc.exe" "src\Sophia_Script_for_Windows_11\Module\Sophia.psm1" --json | ConvertFrom-Json
$blank = $JSON.SUM.blank
$comment = $JSON.SUM.comment
$code = $JSON.SUM.code
# "$((($blank + $comment + $code)/1000).ToString("#.#").replace(",", "."))k"
$Summary = ("{0:N1}k" -f (($blank + $comment + $code)/1000)).replace(",", ".")
$Summary = ((Get-Content -Path "src\Sophia_Script_for_Windows_11\Module\Sophia.psm1").Count | Measure-Object -Sum).Sum
$Summary = "{0:N1}k" -f ($Summary/1000)
Write-Verbose -Message ($blank + $comment + $code) -Verbose
Write-Verbose -Message $Summary -Verbose
echo "CODE_LINES=$Summary" >> $env:GITHUB_ENV
Expand Down

0 comments on commit 8595c44

Please sign in to comment.