Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git safe directory only set in post step which have no effect #2031

Open
npalm opened this issue Jan 6, 2025 · 0 comments
Open

Git safe directory only set in post step which have no effect #2031

npalm opened this issue Jan 6, 2025 · 0 comments

Comments

@npalm
Copy link

npalm commented Jan 6, 2025

The checkout action allows to set set-safe-directory, which is by default set to true. Which according to the docs will configure git to set the current working directory as a safe directory. However, this step is only executed is post job step.

To me this seems have no usages, since after the the post step the job is done and context gone (for ephemeral runners). Wondering if this intenstional or a potential bug. In case it is not a bug it is at least a short coming in the docs. The docs are not mentioning the safe-directory is confiugred as post step at all. The file get-source-provider.ts hints that the function is avaiable for using the checkout aciton in a container job which is exactly our use case.

In our case we run the following

  job:
    runs-on: [ubuntu-latest]
    container: node:20.17-bookworm
    steps:
      - name: Checkout
        uses: actions/checkout

      - name: Check git
         run: |
           git config --list

           ### RESULT not safe directory set

      - name: Prettier
        run: yarn prettier:write

      - name: suggester / prettier
        uses: reviewdog/action-suggester
        with:
          tool_name: prettier
          filter_mode: nofilter
          

In this case the action reviewdog/action-suggester is failing with errors not a git direcotry. When we add in the setp Check git run a git config --global -add safe.directory WORKS_SPACE_DIR. All works fine. We see in the post step the eheckout action is setting the safe directory, but this has no effect anymore.

Please can you explain what the intention is of the set-safe-directroy parameter, and or if it could be a bug that it is running as post step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant