Browse Source

Updated lines count badge method

main
Dmitry Nefedov 3 weeks ago
parent
commit
dee2226ede
  1. 6
      .github/workflows/Badge_downloads.yml
  2. 43
      .github/workflows/Badge_lines.yml

6
.github/workflows/Badge_downloads.yml

@ -73,7 +73,7 @@ jobs:
run: | run: |
# https://gist.github.com/farag2/25ddc72387f298503b752ad5b8d16eed # https://gist.github.com/farag2/25ddc72387f298503b752ad5b8d16eed
$fileContent = @{ $GistContent = @{
schemaVersion = 1 schemaVersion = 1
label = "downloads" label = "downloads"
message = $env:DOWNLOADS_COUNT message = $env:DOWNLOADS_COUNT
@ -84,10 +84,10 @@ jobs:
$Body = @{ $Body = @{
files = @{ files = @{
"SophiaScriptDownloadsCount.json" = @{ "SophiaScriptDownloadsCount.json" = @{
content = $fileContent content = $GistContent
} }
} }
} | ConvertTo-Json -Depth 5 } | ConvertTo-Json
$Headers = @{ $Headers = @{
Authorization = "Bearer $env:GIST_TOKEN" Authorization = "Bearer $env:GIST_TOKEN"
Accept = "application/vnd.github+json" Accept = "application/vnd.github+json"

43
.github/workflows/Badge_lines.yml

@ -32,12 +32,37 @@ jobs:
echo "CODE_LINES=$Summary" >> $env:GITHUB_ENV echo "CODE_LINES=$Summary" >> $env:GITHUB_ENV
- name: Writing to Gist - name: Writing to Gist
uses: schneegans/dynamic-badges-action@master env:
with: GIST_TOKEN: ${{ secrets.GIST_SophiaScript_Lines }}
auth: ${{ secrets.GIST_SophiaScript }} shell: pwsh
gistID: 9852d6b9569a91bf69ceba8a94cc97f4 run: |
filename: SophiaScript.json # https://gist.github.com/farag2/9852d6b9569a91bf69ceba8a94cc97f4
label: Lines of Code
message: ${{ env.CODE_LINES }} $GistContent = @{
namedLogo: PowerShell schemaVersion = 1
color: brightgreen label = "Lines of Code"
message = $env:CODE_LINES
color = "brightgreen"
namedLogo = "PowerShell"
} | ConvertTo-Json
$Body = @{
files = @{
"SophiaScript.json" = @{
content = $GistContent
}
}
} | ConvertTo-Json
$Headers = @{
Authorization = "Bearer $env:GIST_TOKEN"
Accept = "application/vnd.github+json"
}
$Parameters = @{
Uri = "https://api.github.com/gists/9852d6b9569a91bf69ceba8a94cc97f4"
Method = "Patch"
Body = $Body
Headers = $Headers
UseBasicParsing = $true
Verbose = $true
}
Invoke-RestMethod @Parameters

Loading…
Cancel
Save