diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index c86c42d7..ea8edc42 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -594,6 +594,20 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Checkout swiftlang/github-workflows repository + if: ${{ github.repository != 'swiftlang/github-workflows' }} + uses: actions/checkout@v4 + with: + repository: swiftlang/github-workflows + path: github-workflows + - name: Determine script-root path + id: script_path + run: | + if ("${{ github.repository }}" -eq "swiftlang/github-workflows") { + echo "root=$env:GITHUB_WORKSPACE" >> $env:GITHUB_OUTPUT + } else { + echo "root=$env:GITHUB_WORKSPACE/github-workflows" >> $env:GITHUB_OUTPUT + } - name: Provide token if: ${{ inputs.needs_token }} run: | @@ -618,17 +632,10 @@ jobs: echo "image=$Image" >> "$env:GITHUB_OUTPUT" - name: Install Visual Studio Build Tools if: ${{ !inputs.enable_windows_docker }} - run: | - 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 - . $env:TEMP\install-vsb.ps1 - del $env:TEMP\install-vsb.ps1 + run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/install-vsb.ps1 - name: Install Swift if: ${{ !inputs.enable_windows_docker }} - run: | - 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 - 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 - . $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1 - del $env:TEMP\install-swift*.ps1 + run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1 - name: Create test script run: | mkdir $env:TEMP\test-script @@ -656,9 +663,8 @@ jobs: if ("${{ inputs.enable_cross_pr_testing && github.event_name == 'pull_request' }}" -eq "true") { echo @' - 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 # Running in script mode fails on Windows (https://github.com/swiftlang/swift/issues/77263), compile and run the script. - Invoke-Program swiftc -sdk $env:SDKROOT $env:TEMP\cross-pr-checkout.swift -o $env:TEMP\cross-pr-checkout.exe + 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 Invoke-Program $env:TEMP\cross-pr-checkout.exe "${{ github.repository }}" "${{ github.event.number }}" '@ >> $env:TEMP\test-script\run.ps1 }