https://github.com/eddieowens/gpoll
Go library for polling a Git repository
https://github.com/eddieowens/gpoll
git go golang poll
Last synced: 5 months ago
JSON representation
Go library for polling a Git repository
- Host: GitHub
- URL: https://github.com/eddieowens/gpoll
- Owner: eddieowens
- License: mit
- Created: 2019-09-07T23:41:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-05T19:43:48.000Z (over 6 years ago)
- Last Synced: 2025-08-14T01:20:55.901Z (11 months ago)
- Topics: git, go, golang, poll
- Language: Go
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GPoll
[](https://godoc.org/github.com/eddieowens/gpoll)
Go library for polling a Git repository.
## Installation
```
go get github.com/eddieowens/gpoll
```
## Usage
```go
package main
import (
"fmt"
"github.com/eddieowens/gpoll"
"log"
)
func main() {
poller, err := gpoll.NewPoller(gpoll.PollConfig{
Git: gpoll.GitConfig{
Auth: gpoll.GitAuthConfig{
// Uses the SSH key from my local directory.
SshKey: "~/.ssh/id_rsa",
},
// The target remote.
Remote: "git@github.com:eddieowens/gpoll.git",
},
OnUpdate: func(change gpoll.GitChange) {
switch change.EventType {
case gpoll.EventTypeDelete:
fmt.Printf("%s was deleted", change.Filename)
case gpoll.EventTypeUpdate:
fmt.Printf("%s was updated", change.Filename)
case gpoll.EventTypeCreate:
fmt.Printf("%s was created", change.Filename)
}
},
})
if err != nil {
panic(err)
}
// Will poll the repo until poller.Stop() is called.
log.Fatal(poller.Start())
}
```