github-action-benchmark icon indicating copy to clipboard operation
github-action-benchmark copied to clipboard

Settings gh-pages branch to current branch results in fatal Error: 'Refusing to fetch into current branch'

Open NathanielRN opened this issue 3 years ago • 1 comments

This action says in the documentation that if your docs build from your master branch you should simply set the gh-pages-branch to master to have it make a commit on that branch instead.

However, if you trigger the workflow while you are on the master branch itself, then because the action runs a git fetch <branch>:<branch> the action will fail with error:

/usr/bin/git -c user.name=github-action-benchmark -c [email protected] -c http.https://github.com/.extraheader= fetch origin master:master
fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
Error: Command 'git' failed with args '-c user.name=github-action-benchmark -c [email protected] -c http.https://github.com/.extraheader= fetch origin master:master': fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

See this workflow for an example.

Possible solutions include adding a field

should-fetch: true|false

to indicate whether the branch needs to be fetched before creating a commit.

Thank you for the awesome action!

NathanielRN avatar Dec 11 '20 21:12 NathanielRN

+1, having the same issue as well

maximiliancsuk avatar Sep 05 '21 16:09 maximiliancsuk

skip-fetch-gh-pages exists now?

CanadaHonk avatar Jul 23 '23 14:07 CanadaHonk

@CanadaHonk it exists for 4 years already, just wasn't described in the readme. I created PR to fix it.

alvicsam avatar Jul 25 '23 12:07 alvicsam