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

Exclude not working for me #41

Open
woodman231 opened this issue Jun 9, 2020 · 5 comments
Open

Exclude not working for me #41

woodman231 opened this issue Jun 9, 2020 · 5 comments

Comments

@woodman231
Copy link

woodman231 commented Jun 9, 2020

Hello,

For some reason I am not able to get the exclude to work. It is copying the wofklow action itself in to the destination repository. I am sure I am just not doing the globs right. Any help on my config would help:

  - name: Copy
    uses: andstor/copycat-action@v3
    with:
      personal_token: ${{ secrets.PERSONAL_TOKEN }}
      src_path: /.
      dst_path: /site1/
      dst_owner: woodman231
      dst_repo_name: woodman231.github.io
      exclude: /.github/*
      clean: true

I even tried exclude: */.github/* but then it tells me that is an invalid token and won't allow me to save the yml file.

@yceballost
Copy link
Contributor

+1

1 similar comment
@leighajarett
Copy link

+1

@andstor
Copy link
Owner

andstor commented Jun 29, 2020

Hi !

Internally, the exclusion pattern matching is done against a string path. However, it seems that the this string path does not include a leading slash. So currently, to ignore top level files or directories, just don't include a slash at the beginning of the exclude expression. To ignore the .github folder in the root directory, just set the exclude pattern to .github/*.

However, as it is normal to address a root path with a leading slash, this might be beneficial to implement. This would be a breaking change, so we need to be sure that this is the most intuitive and conventional solution. The actual fix seems to be rather simple.

Just change this line:

[[ "$f" == $EXCLUDE ]] && continue

to this:

[[ "/$f" == $EXCLUDE ]] && continue 

This would make it possible to exclude the root directory with the pattern /.github/* or */.github/*. However, the pattern .github would no longer work.

Feedback is much appreciated 🙏

@markcheret
Copy link
Contributor

it wasn't working for me either and I figured it out by experimentation. Even though it is a breaking change, I highly encourage to implement it.

@josesoaresif
Copy link

Is it possible to exclude more than one folder?

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

6 participants