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

How to use a generated file? #3

Closed plocket closed 3 years ago

plocket commented 3 years ago

I couldn't get this action to work with a generated file. I got this action to work using a generated file, but it destroys the destination repository.

I don't want to destroy my destination repository so I'm trying to adapt this action you've created to be able to use a generated file. This is the code I have so far, but it still can't find the generated file.

If you have the time - do you know what's missing?

plocket commented 3 years ago

I managed to get what I needed combining your code with that of @cpina's repo. Couldn't have done it without this code, thank you.

dmnemec commented 3 years ago

What was the fix for this? I'm interested if there's an enhancement I could make to this for that use case.

plocket commented 3 years ago

This was a while ago, so I'm not sure. Maybe it was something about the source file being in a directory as opposed to on its own. The problem was probably somewhere else in the code, though. I do remember tripping over Dockerfiles for a while as I hadn't worked with them before. Sorry I can't be of more help.

adam-at-brown commented 3 years ago

@dmnemec I have experimented with using this with a Gatsby build process. I found running this before your action in the workflow and then pointing the source_file to public (where the compiled code ends up) has worked as expected.


    - name: Navigate to repo
      run: cd $GITHUB_WORKSPACE
    - uses: actions/setup-node@v1
      with:
        node-version: "12.x"
    - name: Install deps
      run: yarn
    - name: Clean for Build
      run: yarn clean
    - name: Build docs
      run: yarn build
dmnemec commented 3 years ago

I may have just realized why the original issue was a problem. The generated file may have been in a different step/job from this action, therefore it wouldn't have been available to this action at that time. The fix would have been to ensure that the actions are all in the same step or to export/import the generated file as an artifact between jobs.