genuinetools / ghb0t Goto Github PK
View Code? Open in Web Editor NEWA GitHub Bot to automatically delete your fork's branches after a pull request has been merged.
License: MIT License
A GitHub Bot to automatically delete your fork's branches after a pull request has been merged.
License: MIT License
When running as a deployment on Kubernetes v1.14.2 I am getting a segfault in under a minute.
time="2019-05-24T10:16:36Z" level=info msg="Bot started for user chris-short."
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x665d3d]
goroutine 1 [running]:
main.handleNotification(0x76e740, 0xc0000464c0, 0xc00009e280, 0xc000200580, 0xc0001e3ef0, 0xb, 0x0, 0x0)
/go/src/github.com/genuinetools/ghb0t/main.go:185 +0x23d
main.getNotifications(0x76e740, 0xc0000464c0, 0xc00009e280, 0xc0001e3ef0, 0xb, 0x1, 0x14, 0x0, 0x0)
/go/src/github.com/genuinetools/ghb0t/main.go:144 +0x1ae
main.main.func2(0x76e740, 0xc0000464c0, 0xc0000101a0, 0x0, 0x0, 0x0, 0x0
/go/src/github.com/genuinetools/ghb0t/main.go:112 +0x3f9 github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli.(*Program).run(0xc0000b4000, 0x76e800, 0xc000010d20, 0xc000010180, 0x3, 0x3, 0x4a87dd, 0x70a507)
/go/src/github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli/cli.go:179 +0x253 github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli.(*Program).Run(0xc0000b4000)
/go/src/github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli/cli.go:89 +0x61
main.main()
go/src/github.com/genuinetools/ghb0t/main.go:120 +0x34b
If I can provide more info lmk, please.
In the absence of a contribution guide, I've opened an issue here because I'd like to experiment with ghb0t
at my organization. Many of our repositories have a different default branch, which in addition to (or instead of) our usage of master
we would not wish to ever have deleted under any circumstances.
I'd like to try my hand at making that change, or if it was something already in your plans, maybe help with. Cheers!
It would be nice to document which scopes are required for the github token. Scoping the token is a must in my case since I am planning to run this on a Kubernetes cluster.
Running a build from master I reliably hit this shortly after startup (v0.4.7 works fine):
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6307e8]
goroutine 1 [running]:
main.handleNotification(0x715ce0, 0xc00007c300, 0xc0000ee280, 0xc000504100, 0xc0001b2010, 0x6, 0x1c, 0xc0003be000)
/go/src/github.com/genuinetools/ghb0t/main.go:185 +0x208
main.getNotifications(0x715ce0, 0xc00007c300, 0xc0000ee280, 0xc0001b2010, 0x6, 0x1, 0x14, 0x0, 0x0)
/go/src/github.com/genuinetools/ghb0t/main.go:144 +0x1ab
main.main.func2(0x715ce0, 0xc00007c300, 0xc00008c010, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/genuinetools/ghb0t/main.go:112 +0x401
github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli.(*Program).run(0xc000104000, 0x715da0, 0xc00007ede0, 0xc00008c000, 0x2, 0x2, 0x4c15f0, 0xc00008a2a0)
/go/src/github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli/cli.go:179 +0x281
github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli.(*Program).Run(0xc000104000)
/go/src/github.com/genuinetools/ghb0t/vendor/github.com/genuinetools/pkg/cli/cli.go:89 +0x67
main.main()
/go/src/github.com/genuinetools/ghb0t/main.go:120 +0x287
main.go:185 being:
defaultBranch := *notification.Repository.DefaultBranch
Looking at the JSON returned from the /notifications
endpoint by hand it looks like there isn't a default_branch
key for the repository and it's not actually listed in the notification docs, so I'm not quite sure where that field is meant to come from.
I have a lot of ancient merged branches in basically all my repos because I never bothered to delete them. It looks like this tool follows the notification stream, but doesn't actually go and clean up old branches. It would be great if it could do that as well.
I suspect that it would require a much larger number of API calls, so maybe it should be optionally enabled by a flag.
huitseeker@sleipnir➜huitseeker/tmp/ghb0t(master)» make [13:28:03]
+ clean
+ build
# _/home/huitseeker/tmp/ghb0t
./main.go:92: not enough arguments in call to client.Users.Get
have (string)
want ("context".Context, string)
./main.go:130: not enough arguments in call to client.Activity.ListNotifications
have (*github.NotificationListOptions)
want ("context".Context, *github.NotificationListOptions)
./main.go:162: not enough arguments in call to client.PullRequests.Get
have (string, string, int)
want ("context".Context, string, string, int)
./main.go:180: not enough arguments in call to client.Git.DeleteRef
have (string, string, string)
want ("context".Context, string, string, string)
make: *** [Makefile:12: build] Error 2
Sounds like an update of github.com/google/go-github/github. Observed at 1807aa3 with go version go1.8 linux/amd64
Hello again @jessfraz !
I was wondering if you had a chance to look into snaps. I was checking the store and saw that you haven't published the package, which could be pretty useful now if you have a couple of minutes.
We just released a new build service. It should be really simple to set up automated delivery there with a couple of clicks: https://build.snapcraft.io/
Please try it whenever you have a chance, and let me know what do you think.
pura vida.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.