Skip to content

Commit aa6e507

Browse files
feat: Enviromentally aware badges and links ( Fixes PoshWeb#23 )
1 parent aed984a commit aa6e507

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

build.ps1

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#>
99
param(
1010
[uri]
11-
$BuildTimeHistoryUrl = "https://4kb.powershellweb.com/history.json"
11+
$BuildTimeHistoryUrl = "https://4kb.powershellweb.com/history.json",
12+
13+
[string]$GitHubRepository = $env:GITHUB_REPOSITORY
1214
)
1315

1416
# Make sure we're in the right place.
@@ -161,13 +163,15 @@ $([Web.HttpUtility]::HtmlAttributeEncode($descriptionMessage))
161163
"<h1>4kb Markdown Files Benchmark</h1>"
162164
"<h2>Time to build 4096 markdown files</h2>"
163165
"<h3>Last built at $([DateTime]::UtcNow.ToString("s")) running @ $cpuSpeed Mhz</h3>"
164-
"<h4><a href='https://github.com/PowerShellWeb/4kbMarkdownFiles/'><button>Github Repo</button></a></h4>"
165-
166-
"<h4>"
167-
"[![Deploy](https://github.com/PowerShellWeb/4kbMarkdownFiles/actions/workflows/deploy.yml/badge.svg)](https://github.com/PowerShellWeb/4kbMarkdownFiles/actions/workflows/deploy.yml)" |
168-
ConvertFrom-Markdown |
169-
Select-Object -ExpandProperty Html
166+
if ($GitHubRepository) {
167+
"<h4><a href='https://github.com/$GitHubRepository/'><button>Github Repo</button></a></h4>"
168+
169+
"<h4>"
170+
"<a href='https://github.com/$GitHubRepository/actions/workflows/deploy.yml'>"
171+
"<img src='https://github.com/$GitHubRepository/actions/workflows/deploy.yml/badge.svg'></img>"
172+
"</a>"
170173
"</h4>"
174+
}
171175

172176
# Make a really basic heatmap (yes, this is that easy)
173177
# We want the fastest item to be the most green, so start by getting its relative speed

0 commit comments

Comments
 (0)