|
12 | 12 | required: false |
13 | 13 | default: false |
14 | 14 | 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 |
15 | 20 | push: |
16 | 21 | tags: |
17 | 22 | - 'v*' |
@@ -104,16 +109,24 @@ jobs: |
104 | 109 | env: |
105 | 110 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
106 | 111 | run: | |
| 112 | + $allowUnreadable = $false |
| 113 | + if ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch') { |
| 114 | + $allowUnreadable = [bool]::Parse("${{ inputs.allow_unreadable_dependabot }}") |
| 115 | + } |
107 | 116 | $alerts = gh api "/repos/$env:GITHUB_REPOSITORY/dependabot/alerts" --paginate 2>$null |
108 | 117 | 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 | + } |
117 | 130 | } |
118 | 131 |
|
119 | 132 | - name: Build release artifacts |
|
0 commit comments