ejoffe / spr

Stacked Pull Requests on GitHub
MIT License
796 stars 68 forks source link

createDraftPRs should be a Repository Config #315

Open felixge opened 1 year ago

felixge commented 1 year ago

First of all: Thanks for this project ❤️. I just started using it, but I'm very excited about it.

I'd like to set createDraftPRs: true in my User Config, but unfortunately this won't work for all of my repositories because GitHub doesn't seem to support this feature for private repos on my personal account (see output and screenshots below).

Would it be possible to turn createDraftPRs into a Repository Config, or allow users to overwrite the User Config for this on a per-repo basis?

Output and Screenshots:

panic: createPullRequest: Draft pull requests are not supported in this repository.

goroutine 1 [running]:
github.com/ejoffe/spr/github/githubclient.check({0x100f3a380, 0x140003702d0})
    /Users/runner/work/spr/spr/github/githubclient/client.go:654 +0x154
github.com/ejoffe/spr/github/githubclient.(*client).CreatePullRequest(0x1400000d128, {0x100f442f0, 0x1400002c0d0}, {0x100f44478, 0x1400000d0e0}, 0x140000320f0, {{0x140001401fb, 0x8}, {0x14000140167, 0x28}, ...}, ...)
    /Users/runner/work/spr/spr/github/githubclient/client.go:372 +0x504
github.com/ejoffe/spr/spr.(*stackediff).UpdatePullRequests(0x14000071080, {0x100f442f0, 0x1400002c0d0}, {0x0, 0x0, 0x0}, 0x0)
    /Users/runner/work/spr/spr/spr/spr.go:204 +0xb00
main.main.func4(0x14000111500)
    /Users/runner/work/spr/spr/cmd/spr/main.go:155 +0x160
github.com/urfave/cli/v2.(*Command).Run(0x140001e8a20, 0x14000111280)
    /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x634
github.com/urfave/cli/v2.(*App).RunContext(0x14000115860, {0x100f442f0, 0x1400002c0d0}, {0x1400001e040, 0x2, 0x2})
    /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x760
github.com/urfave/cli/v2.(*App).Run(...)
    /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
    /Users/runner/work/spr/spr/cmd/spr/main.go:224 +0x150c
CleanShot 2023-05-05 at 08 56 26@2x CleanShot 2023-05-05 at 08 56 32@2x

CleanShot 2023-05-05 at 08 56 37@2x