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

Error "Destination path is not an empty directory" when specifying a configuration file #55

Closed
ppsmilesi opened this issue Aug 2, 2024 · 4 comments · Fixed by #56
Closed
Labels
bug Something isn't working

Comments

@ppsmilesi
Copy link

Hello !

Thank you for the github action and the sizeup library, it looks awesome !

I have tried to run the action with a configuration file without success.
I have checked out the config file at first step of the workflow for it to be available but then, the sizeup action has run into this error:
Error: fatal: destination path '.' already exists and is not an empty directory.

Output of the workflow:

Run lerebear/sizeup-action@v0.8.3
  with:
    token: ***
    configuration-file-path: .github/workflows/sizeup/config.yml
    git-diff-options: --ignore-space-change
Reading sizeup configuration from ".github/workflows/sizeup/config.yml"
Evaluating pull request ...
Error: fatal: destination path '.' already exists and is not an empty directory.

Workflow fiile .github/workflows/sizeup.yml:

name: SizeUp

on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - edited
      - ready_for_review

permissions:
  contents: read
  issues: write
  pull-requests: write

jobs:
  sizeup:
    name: Estimate reviewability
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4 # Check out the repository to be able to read config file
        with:
          sparse-checkout: |
            .github/workflows/sizeup/config.yml
          sparse-checkout-cone-mode: false

      - name: Run sizeup
        # https://github.com/lerebear/sizeup-action/blob/main/README.md#versioning
        uses: lerebear/sizeup-action@v0.8.3
        id: sizeup-action

        with:
          token: "${{ secrets.GITHUB_TOKEN }}"

          configuration-file-path: .github/workflows/sizeup/config.yml

Thank you for your help !

@github-project-automation github-project-automation bot moved this to Triage in SizeUp Aug 2, 2024
@ppsmilesi ppsmilesi changed the title destination path is not an empty directory error when specifying a configuration file Error "Destination path is not an empty directory" when specifying a configuration file Aug 2, 2024
@lerebear
Copy link
Owner

lerebear commented Aug 2, 2024

Thank you for the report @ppsmilesi. I suspect that the error you've encountered is due to incompatibility between actions/checkout and the internal operations of this action. There is a small note on this in the README:

Please note that the workflow configuration above does not use actions/checkout. This is because actions/checkout does not provide enough options to make a customized git diff command maximally efficient. Instead, this Action will perform its own clone, fetch, and checkout operations using the provided token.

Could you please try removing the first step of your workflow (the one that uses actions/checkout)? Once you allow this action to manage the checkout flow then I believe this should work properly.

@lerebear lerebear added bug Something isn't working question Further information is requested and removed bug Something isn't working labels Aug 2, 2024
@ppsmilesi
Copy link
Author

Hey ! Thank you for coming back to me !

I have added the checkout step because without it, the sizeup action cannot even find the config file.

Here is the error:

Run lerebear/sizeup-action@v0.8.3 

with: 

token: *** 

configuration-file-path: .github/workflows/sizeup/config.yml 

git-diff-options: --ignore-space-change 

Reading sizeup configuration from ".github/workflows/sizeup/config.yml" 

Error: ENOENT: no such file or directory, open '.github/workflows/sizeup/config.yml'

I am pretty sure the path to the config file is correct.
Does the action clone the repo before reading the config file for it to be available ?

Thank you

@lerebear lerebear added bug Something isn't working and removed question Further information is requested labels Aug 3, 2024
@github-project-automation github-project-automation bot moved this from Triage to Done in SizeUp Aug 4, 2024
@lerebear
Copy link
Owner

lerebear commented Aug 4, 2024

@ppsmilesi thank you for helping to uncover and debug this issue!

Does the action clone the repo before reading the config file for it to be available ?

It does ordinarily, but I had unwittingly broken this behaviour in #54, which affected 0.8.3. This should now be fixed in 0.8.4. If you run into any further issues please let me know.

@ppsmilesi
Copy link
Author

ppsmilesi commented Aug 18, 2024

Thank you @lerebear ! 0.8.4 is fixed and working 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants