action-push-tag icon indicating copy to clipboard operation
action-push-tag copied to clipboard

Bug: `fatal: not in a git directory`

Open tokestermw opened this issue 3 years ago • 12 comments

What happened

Ran the actions-ecosystem/action-push-tag@v1 Github Action unsuccessfully:

...
"/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/.../...":"/github/workspace" ...
12
fatal: not in a git directory

Probably related to: https://stackoverflow.com/questions/71849415/cannot-add-parent-directory-to-safe-directory-on-git https://news.ycombinator.com/item?id=31009675

What you expected to happen

Successfully pushed tags.

How to reproduce it

I think if you run a workflow with the action-push-tag action this will happen.

Environment

tokestermw avatar Apr 13 '22 02:04 tokestermw

@tokestermw can you please explain why you think it could be related to https://stackoverflow.com/questions/71849415/cannot-add-parent-directory-to-safe-directory-on-git and https://github.blog/2022-04-12-git-security-vulnerability-announced/?

action-push-tag seems to use git version 2.34.2.

aabeling avatar Apr 13 '22 09:04 aabeling

Facing same issue, was working perfectly before

artyom-p avatar Apr 13 '22 12:04 artyom-p

Facing same issue, was working perfectly before

arjangeertsema avatar Apr 13 '22 13:04 arjangeertsema

Yeah it was working before the linked issue. There is some chance it's unrelated, or indirectly related. Not exactly sure what the solution should be.

A workaround is to directly use the code in https://github.com/actions-ecosystem/action-push-tag/blob/main/entrypoint.sh using run (instead of using uses).

Something like:

      - name: Tag
        run: |
          tag=${{ steps.bump-semver.outputs.new_version }}
          message='${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'
          git config user.name "${GITHUB_ACTOR}"
          git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
          git tag -a "${tag}" -m "${message}"
          git push origin "${tag}"

tokestermw avatar Apr 13 '22 15:04 tokestermw

I am running into this as well. Was working fine up until recently.

piekstra avatar Apr 14 '22 22:04 piekstra

Any updates on this?

artyom-p avatar Apr 21 '22 16:04 artyom-p

Hi Here 👋🏼 I'm facing the same issue

E-Acosta-giga avatar Apr 27 '22 15:04 E-Acosta-giga

Could you please put a not on top of the docs that this action is currently broken? There are now quite a few people that seems to have spent time trying this out even though it's broken. Thanks!

tibbe avatar Oct 25 '22 05:10 tibbe

I run into this right after I moved this action call to separate composite action.

deitry avatar Oct 27 '22 08:10 deitry

I tried running pwd and ls -la in entrypoint.sh to try to find out which directory it ends up in, and I don't see that output in the GH action. Any ideas on how to debug what dir this action ends up in after checkout?

thejeff77 avatar Jan 13 '23 17:01 thejeff77

@micnncim - any help here would be great! Seems this has been broken since April of last year.

thejeff77 avatar Jan 13 '23 17:01 thejeff77

Since it seems that they're not maintaining actions ecosystem actions -- I published a working fork of this with added features. https://github.com/marketplace/actions/push-any-git-tag

thejeff77 avatar Feb 08 '23 17:02 thejeff77