Closed eurunuela closed 4 years ago
Correct me if I'm wrong but the
gh
commands seem not to be able to take the repository address as an input parameter, right? This means that every event host should clone the repository to be able to pull the project information, which seems not too practical. If the repository address cannot be provided to the commands, a workaround may be to clone the repository from the script itself and hence be able to complete the process in a single step.
That's correct. AFAIK there's no way of providing the link. I'm not sure if it's possible with the API either. As you mentioned, the best workaround would be to clone the repository with the script. I'll add this step in a new commit.
I just realized we will also have to ask users to install the GitHub CLI. We should mention this on the README.
I just realized we will also have to ask users to install the GitHub CLI. We should mention this on the README.
:+1:.
As for cloning the repository, I would also remove it from disk once finished. And accepting the absolute path/filename of the output name would also be useful I think. We can do it in a separate PR if you want.
As for cloning the repository, I would also remove it from disk once finished. And accepting the absolute path/filename of the output name would also be useful I think. We can do it in a separate PR if you want.
I'll add these suggestions to this PR.
I've made the script a little bit more sophisticated in terms of how it handles paths and the repo. Let me know what you think.
Maybe we're complicating things too much (sorry for that; my fault):
bhg2020
. And even if they did, you are also assuming that the script lives in a folder level immediately above the local copy. It may not be the case.First, I'm sorry. For some reason not all my changes were added to the commit. You can now see the version of the script I wanted to show you.
Anyway, I'll answer your comments:
- I would not assume that people will name their local copy as
bhg2020
. And even if they did, you are also assuming that the script lives in a folder level immediately above the local copy. It may not be the case.
I'm just making sure that if the user has a folder named exactly like the repo (the default directory name when cloning), we do not clone the repo. I don't think the location of the script matters, as we will always be working on the same directory the script is run from.
- If we want to avoid cloning the repository, which I think is fair, then I would make the path to the repository an optional argument to the script. There would not be guesswork in that case.
We could ask the users for the path to the repo and only clone it if this argument is not given.
- You are removing the repository even if it was already present in the users disk. I would only remove the repository if the cloning takes place in the script. I assume that if we specify the folder when checking out and if a folder with that name exists, it will not be cloned, the program will exit and no risk of accidentally removing contents -e.g. a branch in progress, etc.
No, the script does not remove the repo, it actually avoids that. I've tested it to make sure this was the case.
I'm just making sure that if the user has a folder named exactly like the repo (the default directory name when cloning), we do not clone the repo.
The script would fail or not do its job if by any chance the user does have a bhg2020
folder which is not really a git repository or it is a git repository but does not point to the bhg2020
that we believe.
I don't think the location of the script matters, as we will always be working on the same directory the script is run from.
You're right, sorry.
We could ask the users for the path to the repo and only clone it if this argument is not given.
I think that is the safest bet if we want to check the existence of the repository: if the path is given, we do not clone, and just fetch the issues and dump them to the output file; if a path is not given, I would directly call the git clone
command. To avoid the first point in this comment, the destination folder could be given as an optional parameter and be used for this case.
No, the script does not remove the repo, it actually avoids that. I've tested it to make sure this was the case.
I see now. Thanks !
I think that is the safest bet if we want to check the existence of the repository: if the path is given, we do not clone, and just fetch the issues and dump them to the output file; if a path is not given, I would directly call the
git clone
command. To avoid the first point in this comment, the destination folder could be given as an optional parameter and be used for this case.
I've added this with the latest commit.
Thanks for doing this @eurunuela. It should do the job.
Correct me if I'm wrong but the
gh
commands seem not to be able to take the repository address as an input parameter, right? This means that every event host should clone the repository to be able to pull the project information, which seems not too practical. If the repository address cannot be provided to the commands, a workaround may be to clone the repository from the script itself and hence be able to complete the process in a single step.