Skip to content

Commit 638c296

Browse files
committed
Always use the current version of the scripts (Windows)
This applies the changes previously made for Android to Windows
1 parent 00b19f5 commit 638c296

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

.github/workflows/swift_package_test.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,20 @@ jobs:
594594
steps:
595595
- name: Checkout repository
596596
uses: actions/checkout@v4
597+
- name: Checkout swiftlang/github-workflows repository
598+
if: ${{ github.repository != 'swiftlang/github-workflows' }}
599+
uses: actions/checkout@v4
600+
with:
601+
repository: swiftlang/github-workflows
602+
path: github-workflows
603+
- name: Determine script-root path
604+
id: script_path
605+
run: |
606+
if ("${{ github.repository }}" -eq "swiftlang/github-workflows") {
607+
echo "root=$env:GITHUB_WORKSPACE" >> $env:GITHUB_OUTPUT
608+
} else {
609+
echo "root=$env:GITHUB_WORKSPACE/github-workflows" >> $env:GITHUB_OUTPUT
610+
}
597611
- name: Provide token
598612
if: ${{ inputs.needs_token }}
599613
run: |
@@ -618,17 +632,10 @@ jobs:
618632
echo "image=$Image" >> "$env:GITHUB_OUTPUT"
619633
- name: Install Visual Studio Build Tools
620634
if: ${{ !inputs.enable_windows_docker }}
621-
run: |
622-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/install-vsb.ps1 -OutFile $env:TEMP\install-vsb.ps1
623-
. $env:TEMP\install-vsb.ps1
624-
del $env:TEMP\install-vsb.ps1
635+
run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/install-vsb.ps1
625636
- name: Install Swift
626637
if: ${{ !inputs.enable_windows_docker }}
627-
run: |
628-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/swift/install-swift.ps1 -OutFile $env:TEMP\install-swift.ps1
629-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1 -OutFile $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
630-
. $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
631-
del $env:TEMP\install-swift*.ps1
638+
run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1
632639
- name: Create test script
633640
run: |
634641
mkdir $env:TEMP\test-script
@@ -656,9 +663,8 @@ jobs:
656663
657664
if ("${{ inputs.enable_cross_pr_testing && github.event_name == 'pull_request' }}" -eq "true") {
658665
echo @'
659-
Invoke-WebRequest https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/cross-pr-checkout.swift -OutFile $env:TEMP\cross-pr-checkout.swift
660666
# Running in script mode fails on Windows (https://github.com/swiftlang/swift/issues/77263), compile and run the script.
661-
Invoke-Program swiftc -sdk $env:SDKROOT $env:TEMP\cross-pr-checkout.swift -o $env:TEMP\cross-pr-checkout.exe
667+
Invoke-Program swiftc -sdk $env:SDKROOT ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/cross-pr-checkout.swift -o $env:TEMP\cross-pr-checkout.exe
662668
Invoke-Program $env:TEMP\cross-pr-checkout.exe "${{ github.repository }}" "${{ github.event.number }}"
663669
'@ >> $env:TEMP\test-script\run.ps1
664670
}

0 commit comments

Comments
 (0)