python-github-backup icon indicating copy to clipboard operation
python-github-backup copied to clipboard

`--all-starred` does not backup anything

Open andry81 opened this issue 1 year ago • 7 comments

The --starred backups a not empty list. But the --all-starred does nothing.

andry81 avatar Dec 04 '23 02:12 andry81

Pull requests welcome.

josegonzalez avatar Jan 29 '24 12:01 josegonzalez

What full command are you using and what is the expected behavior? This is probably due to a strange combination of command line arguments - and I will admit they are not as intuitive as they could be as features have been incrementally added.

I saw the described behavior with github-backup -t ${T} --starred --all-starred -o output/ whwright, however it does work if you include either --repositories or --all. This is because backing up any repository is gated behind those flags: https://github.com/josegonzalez/python-github-backup/blob/53d2ceec10cc34240e0fb2997e431084bd7ab34f/github_backup/github_backup.py#L978

whwright avatar Jan 31 '24 20:01 whwright

@whwright I retested the latest and the result is the same. It does backup only the RestAPI response. And does not attempt to git clone anything.

Log:

>"c:/python/x64/312/python.exe" "c:/Python/x64/312/Scripts/github-backup" --starred --all-starred --bare -t ghp_* -o "w:\work\MyProjects\!__backup\store\github.com/2024'06'03_23'00'13''543.backup-all-starred/starred/andry81" "andry81"
2024-06-03T23:00:13.749: Create output directory W:\work\MyProjects\!__backup\store\github.com\2024'06'03_23'00'13''543.backup-all-starred\starred\andry81
2024-06-03T23:00:13.750: Backing up user andry81 to W:\work\MyProjects\!__backup\store\github.com\2024'06'03_23'00'13''543.backup-all-starred\starred\andry81
2024-06-03T23:00:13.750: Requesting https://api.github.com/user?per_page=100&page=1
2024-06-03T23:00:14.065: Retrieving repositories
2024-06-03T23:00:14.065: Requesting https://api.github.com/user/repos?per_page=100&page=1
2024-06-03T23:00:15.865: Requesting https://api.github.com/user/repos?per_page=100&page=2
2024-06-03T23:00:19.656: Requesting https://api.github.com/user/repos?per_page=100&page=3
2024-06-03T23:00:21.605: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=1
2024-06-03T23:00:23.826: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=2
2024-06-03T23:00:26.134: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=3
2024-06-03T23:00:29.260: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=4
2024-06-03T23:00:31.604: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=5
2024-06-03T23:00:33.243: Filtering repositories
2024-06-03T23:00:33.244: Backing up repositories
2024-06-03T23:00:33.250: Retrieving andry81 starred repositories
2024-06-03T23:00:33.250: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=1
2024-06-03T23:00:35.637: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=2
2024-06-03T23:00:38.259: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=3
2024-06-03T23:00:40.393: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=4
2024-06-03T23:00:42.673: Requesting https://api.github.com/users/andry81/starred?per_page=100&page=5
2024-06-03T23:00:44.103: Writing 444 starred repositories to disk

After that only the JSON file is existing:

w:\work\MyProjects!__backup\store\github.com\2024'06'03_23'00'13''543.backup-all-starred\starred\andry81\account\starred.json

Is that supposed to work like this?

andry81 avatar Jun 03 '24 20:06 andry81

@andry81 as stated above I believe this will work if you include --repositories or --all

whwright avatar Jun 03 '24 20:06 whwright

Seems https://*****:[email protected]/ url prefix saves in the bare repository config which is not secure I think.

andry81 avatar Jun 03 '24 21:06 andry81

I've added --repositories and it backups both the starred AND mine repositories. I don't won't to backup mine, I want to backup starred only. Is there a way?

andry81 avatar Jun 03 '24 21:06 andry81

Yeah that's true, I think it would be a reasonable change to backup starred repos with only --all-starred. That would be an easy change.

whwright avatar Jun 14 '24 17:06 whwright