From 803a3922c9a2c55f8cb13fbd3d6e5e34eebe96d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kujanp=C3=A4=C3=A4?= Date: Sat, 22 Feb 2025 15:38:06 +0200 Subject: [PATCH 1/2] Fixed Invoke-ContentReplacer.ps1 * Changed -replace to .Replace() to avoid regexp issues * Save replacement result instead of returning it to host --- .github/scripts/Invoke-ContentReplacer.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/scripts/Invoke-ContentReplacer.ps1 b/.github/scripts/Invoke-ContentReplacer.ps1 index 498fb42..1baf8c3 100644 --- a/.github/scripts/Invoke-ContentReplacer.ps1 +++ b/.github/scripts/Invoke-ContentReplacer.ps1 @@ -1,7 +1,7 @@ $readmeRaw = Get-Content 'README.md' -$readmeRaw -replace '## mission', "| :arrows_counterclockwise: | This repo is a mirror of the open source [AzGovViz project](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting) maintained by Julian Hayward, other Microsoft employees, and community members. It is mirrored here with his permission, and this mirror strives to stay in sync with released upstream versions. Please consider making product improvement recommendations on the upstream repo to prevent divergence. Thank you. |`n|-----------|:--------------------------|`n`n## Mission" -$readmeRaw -replace '[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting/badge)](https://scorecard.dev/viewer/?uri=github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting)', '' -$readmeRaw -replace '# Azure Governance Visualizer aka AzGovViz', "[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Azure/Azure-Governance-Visualizer/badge)](https://scorecard.dev/viewer/?uri=github.com/Azure/Azure-Governance-Visualizer)`n`n# Azure Governance Visualizer aka AzGovViz`n`n" +$readmeRaw = $readmeRaw.Replace('## Mission', "| :arrows_counterclockwise: | This repo is a mirror of the open source [AzGovViz project](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting) maintained by Julian Hayward, other Microsoft employees, and community members. It is mirrored here with his permission, and this mirror strives to stay in sync with released upstream versions. Please consider making product improvement recommendations on the upstream repo to prevent divergence. Thank you. |`n|-----------|:--------------------------|`n`n## Mission") +$readmeRaw = $readmeRaw.Replace('[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting/badge)](https://scorecard.dev/viewer/?uri=github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting)', '') +$readmeRaw = $readmeRaw.Replace('# Azure Governance Visualizer aka AzGovViz', "[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Azure/Azure-Governance-Visualizer/badge)](https://scorecard.dev/viewer/?uri=github.com/Azure/Azure-Governance-Visualizer)`n`n# Azure Governance Visualizer aka AzGovViz") $readmeRaw | Set-Content 'README.md' Write-Host 'README.md has been updated with block for upstream notice.' From 34a7056a4e81c54293398bee6bec7611d13ba6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kujanp=C3=A4=C3=A4?= Date: Sat, 22 Feb 2025 15:55:45 +0200 Subject: [PATCH 2/2] Update Invoke-ContentReplacer.ps1 * Removed no-op and extra replacements * Added TODOs --- .github/scripts/Invoke-ContentReplacer.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/scripts/Invoke-ContentReplacer.ps1 b/.github/scripts/Invoke-ContentReplacer.ps1 index 1baf8c3..5d66079 100644 --- a/.github/scripts/Invoke-ContentReplacer.ps1 +++ b/.github/scripts/Invoke-ContentReplacer.ps1 @@ -1,7 +1,9 @@ $readmeRaw = Get-Content 'README.md' $readmeRaw = $readmeRaw.Replace('## Mission', "| :arrows_counterclockwise: | This repo is a mirror of the open source [AzGovViz project](https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting) maintained by Julian Hayward, other Microsoft employees, and community members. It is mirrored here with his permission, and this mirror strives to stay in sync with released upstream versions. Please consider making product improvement recommendations on the upstream repo to prevent divergence. Thank you. |`n|-----------|:--------------------------|`n`n## Mission") -$readmeRaw = $readmeRaw.Replace('[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting/badge)](https://scorecard.dev/viewer/?uri=github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting)', '') -$readmeRaw = $readmeRaw.Replace('# Azure Governance Visualizer aka AzGovViz', "[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Azure/Azure-Governance-Visualizer/badge)](https://scorecard.dev/viewer/?uri=github.com/Azure/Azure-Governance-Visualizer)`n`n# Azure Governance Visualizer aka AzGovViz") +# TODO: GHA changes OpenSSF URLs => no match => no replacement +#$readmeRaw = $readmeRaw.Replace('[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting/badge)](https://scorecard.dev/viewer/?uri=github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting)', '') +# TODO: disabled because previous replacement is does not work/not needed. TBD: is badge injection before the top-level header needed or is the current location good enough? +#$readmeRaw = $readmeRaw.Replace('# Azure Governance Visualizer aka AzGovViz', "[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Azure/Azure-Governance-Visualizer/badge)](https://scorecard.dev/viewer/?uri=github.com/Azure/Azure-Governance-Visualizer)`n`n# Azure Governance Visualizer aka AzGovViz") $readmeRaw | Set-Content 'README.md' Write-Host 'README.md has been updated with block for upstream notice.'