Skip to content

Instantly share code, notes, and snippets.

@subudear
Created July 28, 2023 05:05
Show Gist options
  • Save subudear/14539def5d1cea8a5cc02dca4155747a to your computer and use it in GitHub Desktop.
Save subudear/14539def5d1cea8a5cc02dca4155747a to your computer and use it in GitHub Desktop.
mkdir actions-runner; cd actions-runner
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.306.0/actions-runner-win-x64-2.306.0.zip -OutFile actions-runner-win-x64-2.306.0.zip
if((Get-FileHash -Path actions-runner-win-x64-2.306.0.zip -Algorithm SHA256).Hash.ToUpper() -ne '998fd610e6024cb7015240a82a635a877aab4d6dfb0de89bdd167b0128452721'.ToUpper()){ throw 'Computed checksum did not match' }
Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.306.0.zip", "$PWD")
C:\actions-runner\config.cmd --url https://github.com/Github-AWS-Learning `
--token $(Invoke-RestMethod -Method Post -Uri https://api.github.com/orgs/<REPLACE YOUR ORG NAME>/actions/runners/registration-token `
-Headers @{ "Accept" = "application/json" ; "Authorization" = "Bearer <REPLACE YOUR PAT here>" ;"X-GitHub-Api-Version" = "2022-11-28"}).token `
--name "windows-runner" --work "C:\actions-runner\_work" --runnergroup Windows --replace --unattended --disableupdate;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment