From 459f4c06dc977e8a5d729b51fb4f47f6b1ebc4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8C=C3=A1bera?= Date: Thu, 5 Sep 2019 20:46:59 +0200 Subject: [PATCH] Clarify Excavator problem * Try with SSH * Set remote * Install openssh * ssh-keyscan github.com * Log known hosts * Log known hosts * Revert adding of cosi.psm1 * Correct permissions * test * Test with pub * ? * gci * debug * debug * Test * https * Idiot... * ditch SSH and wait for response from Github * remove debug * debug tags * Revert "debug tags" This reverts commit 5ecf0169ed82e359a8f4b9ffd2c3a4a287712117. * Clarify protected branches * Reflect change of scheduled event naming * Try to keep it old way * Revert "Try to keep it old way" This reverts commit 6a727554b2e072aea3333a6dde51514c470697f4. Workaround with set url is needed https://github.com/Ash258/GithubActionsBucketForTesting/runs/213456507#step:4:110 --- .gitignore | 1 + Dockerfile | 2 +- README.md | 6 ++++-- src/Helpers.psm1 | 9 +++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index dd6b791..8dfdbf8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ LocalTestEnvironment.ps1 +Cosi* diff --git a/Dockerfile b/Dockerfile index 6c0409c..35960da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ ENV SCOOP /SCOOP ENV SCOOP_HOME ${SCOOP}/apps/scoop/current ENV SCOOP_DEBUG 1 -RUN apk add --no-cache --virtual .scoop-deps git p7zip aria2 \ +RUN apk add --no-cache --virtual .scoop-deps openssh git p7zip aria2 \ && apk add hub --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ && git clone 'https://github.com/lukesampson/scoop.git' ${SCOOP_HOME} diff --git a/README.md b/README.md index 39366e3..6c8adfa 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,10 @@ Set of automated actions you will ever need as bucket maintainer. Using `stable` ### Excavator (`Excavator | Excavate`) +- ❗❗❗ Protected master branches are not supported ❗❗❗ + - - Periodically execute automatic updates for all manifests. -- Refer to for configuration formats +- Refer to [help page](https://help.github.com/en/articles/events-that-trigger-workflows#scheduled-events) for configuration formats - alternative. - If you do not have custom server / device which could run docker or scheduled task for auto-pr 24/7. @@ -68,7 +70,7 @@ As soon as PR is created (or someone post comment `/verify`) set of these tests ```yml #.github\workflows\schedule.yml on: - schedules: + schedule: - cron: '*/30 * * * *' name: Excavator jobs: diff --git a/src/Helpers.psm1 b/src/Helpers.psm1 index 6566451..a08aeec 100644 --- a/src/Helpers.psm1 +++ b/src/Helpers.psm1 @@ -36,7 +36,7 @@ function Get-EnvironmentVariables { List all environment variables. Mainly debug purpose. Do not leak GITHUB_TOKEN. #> - return Get-ChildItem env: | Where-Object { $_.Name -ne 'GITHUB_TOKEN' } + return Get-ChildItem env: | Where-Object { ($_.Name -ne 'GITHUB_TOKEN') -and ($_.Name -ne 'SSH_KEY') } } function New-Array { @@ -98,11 +98,12 @@ function Initialize-NeededSettings { } else { Write-Log 'Pushing is not possible without email environment' } + $user = ($env:GITHUB_REPOSITORY -split '/')[0] - # TODO: Test push to protected branch - git remote 'set-url' origin "https://${user}:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git" - # Not sure how this will be influenced by organization git config --global user.name $user + # TODO: Organization will work? + $rem = "https://${user}:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git" + git remote 'set-url' --push origin $rem if (-not $env:HUB_VERBOSE) { $env:HUB_VERBOSE = '1'