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

Action not working without parent directory #111

Open
ArthurPahon opened this issue Nov 29, 2023 · 4 comments
Open

Action not working without parent directory #111

ArthurPahon opened this issue Nov 29, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@ArthurPahon
Copy link

Hello, I was always using this github action with all my directories and files in a output main directory.
But this time i have all my dir and files at the root of my repo.
So ofc i switched from source-directory: "output" to source-directory: "." in my .yml file.
But now I have an error saying : fatal: repository 'https://github.com/xxx/yyy.git/' not found
And of course when i placed everything in my output directory i didn't had this problem.

Could you help me with this ?

@ArthurPahon ArthurPahon added the bug Something isn't working label Nov 29, 2023
@cpina
Copy link
Owner

cpina commented Nov 30, 2023

Are they private repositories? Or public repositories? It would be useful a link to to the source repository to see the configuration of the action (which will help to spot some problem, or will help me to reproduce the problem).

Otherwise, if you could reproduce the problem with two public repositories it might help (might help me spotting the problem).

Without analysing your case a lot: I would have expected it to work, so I need to look into it more.

@ArthurPahon
Copy link
Author

Thanks for your answer.

First, this is two private repo.
First one is in the organisation of my school, and that is the repo target. So I had to create a personnal token and authorize the connexion to my school organisation.
Then i came to my other repo, the source one, from where i will push to the target repo, and create a API_TOKEN_GITHUB secret where i placed my token, and a REPOSITORY_TARGET variable where i placed : B-CPP-500-LYN-5-2-rtype-xxx.yyy

Here is my push_repository.yml file :
`name: "Push repository"

on:
push:
branches: ["main"]

jobs:
push_repository:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Push repository"
uses: "cpina/github-action-push-to-another-repository@main"
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: "output"
destination-github-username: "EpitechPromo2026"
destination-repository-name: ${{ vars.REPOSITORY_TARGET }}
user-email: "arthur.pahon@epitech.eu"
target-branch: "main"
`

This is how I organized my repository :
Capture d’écran 2023-12-01 à 16 07 23

@ArthurPahon
Copy link
Author

Please notice me if you need more informations

@cpina
Copy link
Owner

cpina commented Dec 2, 2023

I tried to reproduce your configuration. In here I'm copying from "source-directory: ." to the output:

https://github.com/cpina/push-to-another-repository-example/blob/main/.github/workflows/ci.yml

As seen in the output: https://github.com/cpina/push-to-another-repository-output and in the execution: https://github.com/cpina/push-to-another-repository-example/actions/runs/7066470938/job/19238385917 it seems to be ok!

I don't understand why it would work if you had "source-directory: output/" but not work (with the same configuration) with "source-directory: .". This only makes copying certain folders across, nothing more.

Could you copy-paste all the output of the log? (basically, what you see in https://github.com/cpina/push-to-another-repository-example/actions/runs/7066470938/job/19238385917 in the "Pushes to another repository"). Hopefully you don't need to remove things, but be careful because there might be private information.

If you can, I would re-generate the token, do it carefully again just in case something is wrong. Try again to make it work with "source-directory: output/" (or a source-directory that exists) to double check that works with a directory...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants