Skip to content

Commit bd87297

Browse files
committed
fix: Reintroduce token validity and access checks in the validation process
1 parent 7b2af37 commit bd87297

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

updater/action.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,6 @@ runs:
132132
exit 1
133133
}
134134
135-
# Check token validity and access
136-
gh api repos/${{ github.repository }} --silent 2>&1 | Out-Null
137-
if ($LASTEXITCODE -ne 0) {
138-
Write-Output "::error::GitHub token validation failed. Please verify:"
139-
Write-Output " 1. Token is not empty or malformed"
140-
Write-Output " 2. Token has not expired"
141-
Write-Output " 3. Token has an expiration date set"
142-
Write-Output " 4. Token has 'repo' and 'workflow' scopes"
143-
Write-Output " 5. Token syntax is correct: "'${{ secrets.TOKEN_NAME }}'"
144-
exit 1
145-
}
146-
147135
# Check token scopes (works for classic PATs only)
148136
$headers = curl -sS -I -H "Authorization: token $env:GH_TOKEN" https://api.github.com 2>&1
149137
$scopeLine = $headers | Select-String -Pattern '^x-oauth-scopes:' -CaseSensitive:$false
@@ -161,6 +149,18 @@ runs:
161149
Write-Output "::notice::Could not detect token scopes (this is normal for fine-grained PATs). Ensure token has Contents (write) and Pull Requests (write) permissions."
162150
}
163151
152+
# Check token validity and access
153+
gh api repos/${{ github.repository }} --silent 2>&1 | Out-Null
154+
if ($LASTEXITCODE -ne 0) {
155+
Write-Output "::error::GitHub token validation failed. Please verify:"
156+
Write-Output " 1. Token is not empty or malformed"
157+
Write-Output " 2. Token has not expired"
158+
Write-Output " 3. Token has an expiration date set"
159+
Write-Output " 4. Token has 'repo' and 'workflow' scopes"
160+
Write-Output " 5. Token syntax is correct: "'${{ secrets.TOKEN_NAME }}'"
161+
exit 1
162+
}
163+
164164
Write-Output "✓ GitHub token is valid and has access to this repository"
165165
166166
- name: Configure git credentials

0 commit comments

Comments
 (0)