Skip to content

Commit 2e6c514

Browse files
committed
ci: adds unshipped APIs validation before creating the release
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
1 parent 0156943 commit 2e6c514

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/release-please-gha.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,30 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v6
2929

30+
- name: Validate PublicAPI.Unshipped.txt files are empty
31+
shell: pwsh
32+
run: |
33+
$unshippedFiles = Get-ChildItem 'src/ ' -Recurse -Filter *.Unshipped.txt | Select -ExpandProperty FullName
34+
35+
$hasUnshippedAPIs = $false
36+
37+
foreach ($file in $unshippedFiles) {
38+
$content = Get-Content -Path $file -Raw
39+
# Remove the #nullable enable line and any whitespace
40+
$trimmedContent = $content -replace '^\s*#nullable enable\s*$', '' -replace '^\s+', ''
41+
42+
if ($trimmedContent -ne '') {
43+
Write-Error "❌ $file contains unshipped APIs. Please promote them to PublicAPI.Shipped.txt before releasing.`nContent:`n$content"
44+
$hasUnshippedAPIs = $true
45+
}
46+
}
47+
48+
if ($hasUnshippedAPIs) {
49+
exit 1
50+
}
51+
52+
Write-Output "✅ All PublicAPI.Unshipped.txt files are clean"
53+
3054
- name: Generate GitHub App token
3155
id: app-token
3256
uses: actions/create-github-app-token@v2

0 commit comments

Comments
 (0)