1

I need to add this functionality into my GO program, with goal to poll the repo and perform a git pull on changes. I have been using https://github.com/src-d/go-git but am unable to find a way to poll.

I don't want to use a webhook to avoid creating a server for incoming payloads.

Grokify
  • 15,092
  • 6
  • 60
  • 81
ecl0
  • 385
  • 1
  • 3
  • 13

1 Answers1

0

go-git does not provide this functionality out of the box, so you would need to write a small funciton.

  1. In order to pull a repository periodically in Golang, one could use time.Ticker, as described in Periodically polling a REST endpoint in Go
  2. To pull from a Git repository, instead of http.Get for the REST API endpoint, one could use this _examples/pull/main.go from official go-git documentation

Let me know if that helps!

bzz
  • 663
  • 3
  • 12