Git Product home page Git Product logo

Comments (10)

cpina avatar cpina commented on August 24, 2024 1

@BeastyBlacksmith : Always test it, just in case, but it is the target branch only.

from github-action-push-to-another-repository.

cpina avatar cpina commented on August 24, 2024

Yep, it's expected: https://github.com/cpina/github-action-push-to-another-repository/blob/master/entrypoint.sh#L30

I'll review the documentation to make it more explicit.

Obviously I could make this optional but perhaps if I added the directory feature that we said in the other issue it would be enough for you?

from github-action-push-to-another-repository.

plocket avatar plocket commented on August 24, 2024

I think adding something to the documentation would be great. As for a directory feature, I think it'd be very useful in general, but the fact that the action deletes the other files in the repo means I can't use this action. I need to be able to add files to existing repos.

I do need to generate files, though, and I haven't seen something that can use a generated file like this action. I did see one that could copy an existing file and merge it without deletions. It also has a destination folder feature.

I've started working on a combination of the two actions but I still can't get the run to find the generated file. The workflow looks like it passes, but it actually has a message that says it can't find the file, so it doesn't work.

If you have a moment to take a look I'd appreciate a clue about what I'm missing. I haven't done much with bash or YAML, and nothing at all with Dockerfiles. If you don't have time, no worries. Here's the workflow script I've written to use it in case that helps. [This is the bash script that it runs]

from github-action-push-to-another-repository.

plocket avatar plocket commented on August 24, 2024

Eventually I'd [I might] actually like to copy a file in the source repo, modify it, and push that modified file into the right folders.

from github-action-push-to-another-repository.

cpina avatar cpina commented on August 24, 2024

Hi @plocket ,

The other (https://github.com/dmnemec/copy_file_to_another_repo_action) repository that you linked uses a very similar script to mine. I even had to double check if I or the other repo copied each other/was a forked/took inspiration from a common place :-)

I've had a look at your scripts. Without knowing the exact errors that you see, how they were triggered, etc. I'm not able to suggest a fix.

I can suggest something another approach. If what you are doing is for a project that you have and if you get stuck with existing Github Actions or writing a Github Action: perhaps as a first step do it just calling the commands from your Github Action (without encapsulating into a new one so avoiding Docker).

For example, look at this other file: https://github.com/Swiss-Polar-Institute/project-application/blob/master/.github/workflows/ci-test-coverage.yml#L31 it's just calling a shell script: there is no Docker, no Github Actions, all in one repository... possibly it's easier.

I think that you are almost there with the code and perhaps you don't need a Dockerfile and creating a new action but can execute it from your workflow (then it's harder to redistribute to other repos but possibly you don't need this) You need the Github Token to do the push obviously but it should be accessible from the shell script.

Another option is that this weekend I might add a configuration variable to not delete the files and to copy them into a subdirectory and this might solve your problems.

Feel free to send the exact error if I can help - the main problem with this is that it has many moving parts: origin repo, destination, github action, etc.

from github-action-push-to-another-repository.

plocket avatar plocket commented on August 24, 2024

Thanks for the tips. You're completely right about copying your repo and the other repo - when I said 'combining the two actions' I meant that I was combining the code from your repo and the code from the other repo. I made comments in the code that referenced both of your repositories and if I get it working, I'll put links to both of them in the README.

I decided to just fork your repo and change it bit by bit and I got something that works. I copied the code into the repo you saw and it didn't work anymore - it has permissions issues again. Here are the actions that are failing.

Maybe I'll just change the name of the forked repo since it's working and get rid of the other repo, but I'd love to know what the heck the difference is. I don't think the code refers to itself anywhere, so it seems like it should just work.

from github-action-push-to-another-repository.

cpina avatar cpina commented on August 24, 2024

Right now I was looking at your code. I couldn't find anything wrong with the current code (I didn't check the older one from 8 hours ago when you wrote): have you just fixed it? https://github.com/plocket/source_repo/actions :-)

from github-action-push-to-another-repository.

plocket avatar plocket commented on August 24, 2024

This fork that I altered works and is complete now. I did change the names, like I said.

An action I made myself by copying and pasting creates errors when it's used. In my previous post I linked to an action that was failing when the code was trying to use this broken action. I still have not been able to get that action to work. This is the file that uses the broken repo and causes the errors.

I hope I don't run into that situation again and get stuck, but I've got something that's working so I can probably move on with that. If you don't want to track down the mystery of the inconsistent behavior, I understand. If you look at it and find what the breaking difference between the two repos is I'd appreciate learning more.

Thanks for this repo, it was a good starting point for what I needed.

from github-action-push-to-another-repository.

plocket avatar plocket commented on August 24, 2024

It took a bit of playing around, asking some questions, and playing around a bit more, but I got something that works for me. As I said in the following issue, thanks for the help and for your code. I couldn't have gotten what I needed without it.

from github-action-push-to-another-repository.

BeastyBlacksmith avatar BeastyBlacksmith commented on August 24, 2024

I may need a clarification here. Does it delete files on all branches or only the target branch?

from github-action-push-to-another-repository.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.