copycat-action icon indicating copy to clipboard operation
copycat-action copied to clipboard

Exclude not working for me

Open woodman231 opened this issue 4 years ago • 5 comments

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.

woodman231 avatar Jun 09 '20 00:06 woodman231

+1

yceballost avatar Jun 16 '20 08:06 yceballost

+1

leighajarett avatar Jun 29 '20 13:06 leighajarett

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: https://github.com/andstor/copycat-action/blob/0d78a5b62732ca0cd61f353be769a3695a38607c/entrypoint.sh#L107 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 🙏

andstor avatar Jun 29 '20 15:06 andstor

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.

markcheret avatar May 01 '21 11:05 markcheret

Is it possible to exclude more than one folder?

josesoaresif avatar Mar 24 '22 12:03 josesoaresif