cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
955 stars 33 forks source link

Would like to back up to GitHub organization #168

Closed iay closed 11 months ago

iay commented 11 months ago

I have a use case where the destination I'd like to use with Gickup is a GitHub organization rather than a GitHub user.

I tried creating a fine-grained personal access token from my own user for that organization, but I got 403 errors when running the backup. I think this is because regardless of the resource owner you set when you create the PAT, Gickup always uses the creator or the PAT as the destination user in which to create the new repository.

I think I confirmed this by creating another PAT for my personal user, from my personal user; Gickup correctly created the repository there.

It would be nice to be able to back up to a GitHub organization. I don't know whether it's possible to introspect the token to discover the associated resource owner, but if so that would seem like the best approach.

Falling back from that, the ability to override the user discovered by user, _, err := client.Users.Get(context.TODO(), "") in github.go might be enough. I'm not a Go programmer at all, so I'm on pretty thin ice here and I'm not sure if that even makes sense.

cooperspencer commented 11 months ago

That's a good usecase. I didn't think of that. I will investigate it and get back to you as soon as I figured something out.

cooperspencer commented 11 months ago

That was a bit tricky but I figured it out. I implemented a new parameter called organization in the Github destination. Now, you can simply configure the organization, you want to back up to, in Gickup. If your token has sufficient permissions, it should work just fine. https://github.com/cooperspencer/gickup/pull/169

cooperspencer commented 11 months ago

It's available in v0.10.19

iay commented 11 months ago

That seems to be working perfectly for me now, thanks for that.

I've run into a second problem which may again be GitHub-specific, but I'll open another issue when I've poked around a bit more.