Ash258 / Scoop-GithubActions

Deprecated. Use https://github.com/shovel-org/GithubActions
MIT License
25 stars 18 forks source link

Push problems with excavator #45

Closed Ash258 closed 5 years ago

Ash258 commented 5 years ago

In newer version of actions there is something wrong. It looks like that git config --global user.name $env:GITHUB_ACTOR will be needed now.

Updating ...
hub pull origin master
From https://github.com/Ash258/GithubActionsBucketForTesting
 * branch            master     -> FETCH_HEAD
Already up to date.
hub checkout master
Switched to a new branch 'master'
M   .github/workflows/issue_comment.yml
M   .github/workflows/issues.yml
M   .github/workflows/pull_request.yml
M   .github/workflows/schedule.yml
Branch 'master' set up to track remote branch 'master' from 'origin'.
Pushing updates ...
hub push origin master
fatal: could not read Username for 'https://github.com': No such device or address
^^^ Error! See above ^^^ (last command: hub push origin master)
Ash258 commented 5 years ago

PR action is affected as well

Ash258 commented 5 years ago

9 days and GitHub support still not replied.

Maybe something like this could help 🤔

git config --global credential.helper store
Add-Content "$HOME\.git-credentials" "https://${env:GITHUB_TOKEN}:x-oauth-basic@github.com`n"

Still nothing. I cannot make it work with some git hacks.

Ash258 commented 5 years ago

🤔

git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" "HEAD:$GITHUB_REF"

Something like $user = ($env:GITHUB_REPOSITORY -split '/')[0]; git remote set-url origin "https://${user}:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git"

This could potentially work, but could be broken on protected branches.

Ash258 commented 5 years ago

Nice. Pushing is now possible for excavator and PR creation on hash fails.

https://github.com/Ash258/GithubActionsBucketForTesting/commit/e377953ba5552613b185ca3d77b5321c682f3a77/checks#step:4:99

TEST protected branch pushes

Ash258 commented 5 years ago

As I thought https://github.com/Ash258/GithubActionsBucketForTesting/runs/199161544#step:4:93

Ash258 commented 5 years ago

https://github.community/t5/How-to-use-Git-and-GitHub/How-to-push-to-protected-branches-in-a-GitHub-Action/m-p/29609

Ash258 commented 5 years ago

Push problem was resolved. Protected branches are not supported intentionally.

https://github.community/t5/GitHub-Actions/How-to-push-to-protected-branches-in-a-GitHub-Action/m-p/30710/highlight/true#M526