Browse Source

Update Badge.yml

Update Badge.yml
master
Dmitry Nefedov 7 months ago
parent
commit
8595c44383
  1. 33
      .github/workflows/Badge.yml

33
.github/workflows/Badge.yml

@ -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

Loading…
Cancel
Save