Browse Source

Update Badge.yml

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

33
.github/workflows/Badge.yml

@ -18,39 +18,12 @@ jobs:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@main 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 - name: Get the Numbers
run: | run: |
$JSON = & "$PSScriptRoot\cloc.exe" "src\Sophia_Script_for_Windows_11\Module\Sophia.psm1" --json | ConvertFrom-Json $Summary = ((Get-Content -Path "src\Sophia_Script_for_Windows_11\Module\Sophia.psm1").Count | Measure-Object -Sum).Sum
$blank = $JSON.SUM.blank $Summary = "{0:N1}k" -f ($Summary/1000)
$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(",", ".")
Write-Verbose -Message ($blank + $comment + $code) -Verbose Write-Verbose -Message $Summary -Verbose
echo "CODE_LINES=$Summary" >> $env:GITHUB_ENV echo "CODE_LINES=$Summary" >> $env:GITHUB_ENV

Loading…
Cancel
Save