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

Add more logging in prepareExistingDirectory so users know why clean: false is not being respected #1340

Open
dhirschfeld opened this issue May 22, 2023 · 0 comments

Comments

@dhirschfeld
Copy link

I'm setting clean: false and actions/checkout is still deleting the contents of the repository?!?

Syncing repository: org/repo
::group::Getting Git version info
Getting Git version info
  Working directory is '/home/runner/work/repo/repo'
  ##[debug]Getting git version
  /usr/bin/git version
  git version 2.40.1
  ##[debug]0
  ##[debug]git version 2.40.1
  ##[debug]
  ##[debug]Set git useragent to: git/2.40.1 (github-actions-checkout)
  ::endgroup::
::add-mask::***
Temporarily overriding HOME='/home/runner/work/_temp/92c432d1-96fd-4c7a-8b60-65883f63951b' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/repo/repo
##[debug]0
##[debug]
Deleting the contents of '/home/runner/work/repo/repo'  <---- ????????????
::group::Initializing the repository
<snip>

Grepping the source it appears that there are multiple other hidden conditions that will mean actions/checkout silently ignores the explicitly specified user config:

// Check whether using git or REST API
if (!git) {
remove = true
}
// Fetch URL does not match
else if (
!fsHelper.directoryExistsSync(path.join(repositoryPath, '.git')) ||
repositoryUrl !== (await git.tryGetFetchUrl())
) {
remove = true
} else {

Because there is no logging in any of these conditions I'm left none-the-wiser why actions/checkout is ignoring my config (there is logging in some other conditions which set remove = true so I'm apparently not hitting those conditions).

@dhirschfeld dhirschfeld changed the title clean: false does not work Add more logging in prepareExistingDirectory so users know why clean: false is not being respected May 22, 2023
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