File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949
5050cd ${INPUT_DIRECTORY}
5151
52+ if git symbolic-ref --quiet HEAD > /dev/null 2>&1 ; then
53+ _DETACHED_HEAD=false
54+ else
55+ _DETACHED_HEAD=true
56+ fi
57+
58+ if ${_DETACHED_HEAD} ; then
59+ echo " Warning: The repository is in a detached HEAD state." ;
60+ echo " This happens when actions/checkout checks out a tag, a commit SHA, or a" ;
61+ echo " pull-request merge commit rather than a real branch." ;
62+ echo " To resolve this, check out a branch explicitly in your actions/checkout step," ;
63+ echo " for example: 'ref: \$ {{ github.head_ref }}' or 'ref: main'." ;
64+ echo " Note: setting this action's 'branch' input (e.g. branch: main) only controls" ;
65+ echo " the push destination — it does not check out a branch in your workspace." ;
66+ fi
67+
5268if [ " ${INPUT_PULL} " != " false" ]; then
53- if ! git symbolic-ref --quiet HEAD > /dev/null 2>&1 ; then
69+ if ${_DETACHED_HEAD} ; then
5470 echo " Error: 'pull' is enabled but the repository is in detached HEAD state."
5571 echo " git pull only works when a branch is currently checked out."
5672 echo " Either disable the 'pull' input or check out a branch explicitly"
You can’t perform that action at this time.
0 commit comments