name: TestDriver.ai Run on: workflow_run: workflows: ["TestDriver.ai Build"] types: - completed env: GO_VERSION: "1.23" NODE_VERSION: 22 permissions: contents: read # To allow the action to read repository contents pull-requests: write # To allow the action to create/update pull request comments jobs: run_testdriver: name: Run TestDriver.ai runs-on: windows-latest steps: - uses: testdriverai/action@main id: testdriver env: FORCE_COLOR: "3" with: key: ${{ secrets.DASHCAM_API }} prerun: | $headers = @{ Authorization = "token ${{ secrets.GITHUB_TOKEN }}" } $downloadFolder = "./download" $artifactFileName = "waveterm.exe" $artifactFilePath = "$downloadFolder/$artifactFileName" Write-Host "Starting the artifact download process..." # Create the download directory if it doesn't exist if (-not (Test-Path -Path $downloadFolder)) { Write-Host "Creating download folder..." mkdir $downloadFolder } else { Write-Host "Download folder already exists." } # Fetch the artifact upload URL Write-Host "Fetching the artifact upload URL..." $artifactUrl = (Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" -Headers $headers).artifacts[0].archive_download_url if ($artifactUrl) { Write-Host "Artifact URL successfully fetched: $artifactUrl" } else { Write-Error "Failed to fetch the artifact URL." exit 1 } # Download the artifact (zipped file) Write-Host "Starting artifact download..." $artifactZipPath = "$env:TEMP\artifact.zip" try { Invoke-WebRequest -Uri $artifactUrl ` -Headers $headers ` -OutFile $artifactZipPath ` -MaximumRedirection 5 Write-Host "Artifact downloaded successfully to $artifactZipPath" } catch { Write-Error "Error downloading artifact: $_" exit 1 } # Unzip the artifact $artifactUnzipPath = "$env:TEMP\artifact" Write-Host "Unzipping the artifact to $artifactUnzipPath..." try { Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force Write-Host "Artifact unzipped successfully to $artifactUnzipPath" } catch { Write-Error "Failed to unzip the artifact: $_" exit 1 } # Find the installer or app executable $artifactInstallerPath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1 if ($artifactInstallerPath) { Write-Host "Executable file found: $($artifactInstallerPath.FullName)" } else { Write-Error "Executable file not found. Exiting." exit 1 } # Run the installer and log the result Write-Host "Running the installer: $($artifactInstallerPath.FullName)..." try { Start-Process -FilePath $artifactInstallerPath.FullName -Wait Write-Host "Installer ran successfully." } catch { Write-Error "Failed to run the installer: $_" exit 1 } # Optional: If the app executable is different from the installer, find and launch it $wavePath = Join-Path $env:USERPROFILE "AppData\Local\Programs\waveterm\Wave.exe" Write-Host "Launching the application: $($wavePath)" Start-Process -FilePath $wavePath Write-Host "Application launched." prompt: | 1. /run testdriver/onboarding.yml