Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Commit

Permalink
Fallback email #56
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 committed Nov 8, 2019
1 parent e79a054 commit 796c20c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,12 @@ function Initialize-NeededSettings {
#>
@('buckets', 'cache') | ForEach-Object { New-Item (Join-Path $env:SCOOP $_) -Force -ItemType Directory | Out-Null }

if ($env:GITH_EMAIL) {
git config --global user.email $env:GITH_EMAIL
} else {
Write-Log 'Pushing is not possible without email environment'
}

$user = ($env:GITHUB_REPOSITORY -split '/')[0]
$email = if ($env:GITH_EMAIL) { $env:GITH_EMAIL } else { 'scoop-bucket-minion@users.noreply.github.com' }
$rem = "https://${env:GITHUB_ACTOR}:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git"

git config --global user.name $user
# TODO: Organization will work? If no, then try to use x-access-token
# $rem = "https://x-access-token:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git"
$rem = "https://${user}:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git"
git config --global user.email $email
git remote 'set-url' --push origin $rem

if (-not $env:HUB_VERBOSE) {
Expand Down

0 comments on commit 796c20c

Please sign in to comment.