dmnemec / copy_file_to_another_repo_action

This GitHub Action copies a file from the current repository to a location in another repository
Apache License 2.0
182 stars 201 forks source link

Setting up to use default Github env. variables #56

Open damiththa opened 2 years ago

damiththa commented 2 years ago

Instead of having to hard code the destination_repo, it might be ideal if this can take default GitHub env. variables. Please see below. This could come in handy, especially if this yml is to be used as a template for multiple repos.

...
    - name: Pushes output to destination repository
      uses: dmnemec/copy_file_to_another_repo_action@main 
      env:
        API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
      with:
        source_file: 'fromFolder/'
        destination_repo: '${GITHUB_REPOSITORY}'
        destination_folder: 'toFolder'
...
dmnemec commented 2 years ago

That change for destination would copy a file from inside the repo to another location in the same repo, via a commit. I'm not sure I'm following what you're asking here.

damiththa commented 2 years ago

Thank you for the reply and yes, that's exactly what it is. We are thinking running a GitHub Action that does some linting and then extracting some code snippets that gets created in the fromFolderand then move them into toFolder .

If destination_repo accepts either itself or a separate repo as an argument that can be passed in, then it'll do the trick.

anoricp commented 1 year ago

I also noticed that I can't get env variable that already defined to work. source_file: '$PATH/file.txt' cp: can't stat '$PATH/ile.txt': No such file or directory

I tried several ways with no luck. Hope there is a update add envs support if isn't there already thanks.