Skip to content

Commit 8ae3a3b

Browse files
committed
Enhance Python CI workflow with main branch releases.properties sync and GitHub token authentication
1 parent 4ac4940 commit 8ae3a3b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/python-test.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ jobs:
3232
with:
3333
fetch-depth: 0
3434

35+
- name: Ensure releases.properties from main branch
36+
run: |
37+
# For PRs, ensure we're checking releases.properties from main branch
38+
if [ "${{ github.event_name }}" = "pull_request" ]; then
39+
echo "Fetching releases.properties from main branch..."
40+
git fetch origin main:main
41+
git checkout main -- releases.properties || echo "Could not fetch releases.properties from main"
42+
fi
43+
3544
- name: Detect Versions to Test
3645
id: detect
3746
run: |
@@ -189,6 +198,8 @@ jobs:
189198
steps:
190199
- name: Checkout Repository
191200
uses: actions/checkout@v4
201+
with:
202+
fetch-depth: 0
192203

193204
- name: Create Test Results Directory
194205
run: |
@@ -198,6 +209,8 @@ jobs:
198209
- name: Phase 1.1 - Download and Extract Python
199210
id: download-python
200211
continue-on-error: true
212+
env:
213+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
201214
run: |
202215
$ErrorActionPreference = "Stop"
203216
$version = "${{ matrix.version }}"
@@ -244,7 +257,18 @@ jobs:
244257
Write-Host "Target file: $downloadPath"
245258
246259
try {
247-
Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadPath -UseBasicParsing -TimeoutSec 300
260+
# Try download with GitHub token for authentication (helps with pre-releases)
261+
$headers = @{}
262+
if ($env:GITHUB_TOKEN) {
263+
$headers["Authorization"] = "token $env:GITHUB_TOKEN"
264+
Write-Host "Using GitHub token for authentication"
265+
}
266+
267+
if ($headers.Count -gt 0) {
268+
Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadPath -Headers $headers -UseBasicParsing -TimeoutSec 300
269+
} else {
270+
Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadPath -UseBasicParsing -TimeoutSec 300
271+
}
248272
} catch {
249273
Write-Host "❌ ERROR: Download failed!"
250274
Write-Host "Error details: $($_.Exception.Message)"

0 commit comments

Comments
 (0)