Skip to content

Commit 25c6867

Browse files
committed
release-gate-override
1 parent 06ac238 commit 25c6867

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212
required: false
1313
default: false
1414
type: boolean
15+
allow_unreadable_dependabot:
16+
description: Allow a manual release when the Dependabot API is unavailable (requires external alert review)
17+
required: false
18+
default: false
19+
type: boolean
1520
push:
1621
tags:
1722
- 'v*'
@@ -104,16 +109,24 @@ jobs:
104109
env:
105110
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106111
run: |
112+
$allowUnreadable = $false
113+
if ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch') {
114+
$allowUnreadable = [bool]::Parse("${{ inputs.allow_unreadable_dependabot }}")
115+
}
107116
$alerts = gh api "/repos/$env:GITHUB_REPOSITORY/dependabot/alerts" --paginate 2>$null
108117
if ($LASTEXITCODE -ne 0) {
109-
throw "Dependabot alerts API is not readable. Enable Dependabot alerts / security-events read access before publishing."
110-
}
111-
$critical = @($alerts | ConvertFrom-Json | Where-Object {
112-
$_.state -eq 'open' -and $_.security_advisory.severity -in @('high', 'critical')
113-
})
114-
if ($critical.Count -gt 0) {
115-
$names = $critical | ForEach-Object { $_.dependency.package.ecosystem + ':' + $_.dependency.package.name } | Sort-Object -Unique
116-
throw "Open high/critical Dependabot alerts block release: $($names -join ', ')"
118+
if (-not $allowUnreadable) {
119+
throw "Dependabot alerts API is not readable. Enable Dependabot alerts / security-events read access before publishing."
120+
}
121+
Write-Warning "Dependabot alerts API is unavailable; manual override was explicitly supplied after external alert review."
122+
} else {
123+
$critical = @($alerts | ConvertFrom-Json | Where-Object {
124+
$_.state -eq 'open' -and $_.security_advisory.severity -in @('high', 'critical')
125+
})
126+
if ($critical.Count -gt 0) {
127+
$names = $critical | ForEach-Object { $_.dependency.package.ecosystem + ':' + $_.dependency.package.name } | Sort-Object -Unique
128+
throw "Open high/critical Dependabot alerts block release: $($names -join ', ')"
129+
}
117130
}
118131
119132
- name: Build release artifacts

0 commit comments

Comments
 (0)