Created
June 3, 2024 19:11
-
-
Save matejskubic/25c7fdfb0da857602b7e7e58215252ec to your computer and use it in GitHub Desktop.
Copy GitHub action variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export to .env file - Does not work with Windows Poershell 5.1 | |
$tmpFile = [System.IO.Path]::GetTempFileName() | |
Write-Verbose -Verbose "Using $tmpFile" | |
gh variable list --json name,value --template "{{range .}}{{.name}}={{.value}}`n{{end}}" | Out-File -FilePath $tmpFile -Encoding utf8NoBOM | |
# cd to new repo or update Owner/Repo | |
gh variable set --env-file $tmpFile --repo Owner/Repo | |
Remove-Item $tmpFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ghVars = gh variable list --json name,value | ConvertFrom-Json | |
# cd to new repo or update Owner/Repo | |
gh variable set --env-file $tmpFile --repo Owner/Repo | |
$ghVars | % { $_.value | gh variable set $_.name --repo Owner/Repo } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment