There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Is there a Git repository activity aggregator, like GitHub's user activity but platform independent?

I’m looking for something like GitHub’s user activity indicator that gathers information from a list of git repositories regardless of where they are hosted (as long as they are public), that I can put on my webpage, kind of as a thing to show what I’m working on at the moment.

Is this a thing that already exists? I’d started writing one a while ago but instead of reviving that it would be great if there’s something that already exists and I can just use :^)

otl ,
@otl@hachyderm.io avatar

@2xsaiko RSS/Atom feeds were developed for this use case. GitHub, GitLab, Codeberg (Forgejo), Sourcehut, even cgit and git's own gitweb serve feeds. For example here's my GitHub account: https://github.com/ollytom.atom
my main OSS project: https://git.olowe.co/streaming/atom/

Atom feeds are widely supported (it's how I found this post!) and there are many libraries/apps/plugins for aggregation. Robust old tech. And no need to limit feeds to Git activity if you don't want to :) Good luck!

@technology

2xsaiko OP ,
@2xsaiko@discuss.tchncs.de avatar

Oh nice, I wasn’t aware there were RSS feeds for git repositories! Makes sense though. I’ll look into this.

arran4 ,

I asked chatgpt to write a go program for this, this looks roughly correct (I have used both libraries before) obviously this won’t be enough for your particular use case. I imagine you can integrate an RSS feed to your site, however if you’re using something like hugo perhaps output it as a csv.

Super low effort but a good start I think:


<span style="font-weight:bold;color:#a71d5d;">package</span><span style="color:#323232;"> main
</span><span style="color:#323232;">
</span><span style="font-weight:bold;color:#a71d5d;">import </span><span style="color:#323232;">(
</span><span style="color:#323232;">	</span><span style="color:#183691;">"fmt"
</span><span style="color:#323232;">	</span><span style="color:#183691;">"log"
</span><span style="color:#323232;">	</span><span style="color:#183691;">"os"
</span><span style="color:#323232;">	</span><span style="color:#183691;">"strings"
</span><span style="color:#323232;">	</span><span style="color:#183691;">"time"
</span><span style="color:#323232;">
</span><span style="color:#323232;">	git </span><span style="color:#183691;">"github.com/go-git/go-git/v5"
</span><span style="color:#323232;">	rss </span><span style="color:#183691;">"github.com/jteeuwen/go-pkg-rss"
</span><span style="color:#323232;">)
</span><span style="color:#323232;">
</span><span style="font-weight:bold;color:#a71d5d;">const </span><span style="color:#323232;">(
</span><span style="color:#323232;">	timeout </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">5 </span><span style="font-style:italic;color:#969896;">// timeout in seconds for the RSS feed generation
</span><span style="color:#323232;">)
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">// Repository represents a git repository with its URL
</span><span style="font-weight:bold;color:#a71d5d;">type </span><span style="color:#323232;">Repository </span><span style="font-weight:bold;color:#a71d5d;">struct </span><span style="color:#323232;">{
</span><span style="color:#323232;">	URL </span><span style="font-weight:bold;color:#a71d5d;">string
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">// Repositories is the list of git repositories
</span><span style="font-weight:bold;color:#a71d5d;">var </span><span style="color:#323232;">Repositories </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">[]Repository{
</span><span style="color:#323232;">	{URL: </span><span style="color:#183691;">"https://github.com/owner/repo1"</span><span style="color:#323232;">},
</span><span style="color:#323232;">	{URL: </span><span style="color:#183691;">"https://github.com/owner/repo2"</span><span style="color:#323232;">},
</span><span style="color:#323232;">	</span><span style="font-style:italic;color:#969896;">// Add more repositories here
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">// FetchLatestTag fetches the latest tag from a git repository
</span><span style="font-weight:bold;color:#a71d5d;">func </span><span style="font-weight:bold;color:#795da3;">FetchLatestTag</span><span style="color:#323232;">(repoURL </span><span style="font-weight:bold;color:#a71d5d;">string</span><span style="color:#323232;">) (</span><span style="font-weight:bold;color:#a71d5d;">string</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">string</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">error</span><span style="color:#323232;">) {
</span><span style="color:#323232;">	</span><span style="font-style:italic;color:#969896;">// Clone the repository to a temporary directory
</span><span style="color:#323232;">	dir, err </span><span style="font-weight:bold;color:#a71d5d;">:=</span><span style="color:#323232;"> os.MkdirTemp(</span><span style="color:#183691;">""</span><span style="color:#323232;">, </span><span style="color:#183691;">"repo"</span><span style="color:#323232;">)
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#183691;">""</span><span style="color:#323232;">, </span><span style="color:#183691;">""</span><span style="color:#323232;">, err
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">defer</span><span style="color:#323232;"> os.RemoveAll(dir)
</span><span style="color:#323232;">
</span><span style="color:#323232;">	_, err </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> git.PlainClone(dir, </span><span style="color:#0086b3;">true</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">git.CloneOptions{
</span><span style="color:#323232;">		URL:      repoURL,
</span><span style="color:#323232;">		Progress: os.Stdout,
</span><span style="color:#323232;">	})
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#183691;">""</span><span style="color:#323232;">, </span><span style="color:#183691;">""</span><span style="color:#323232;">, err
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	repo, err </span><span style="font-weight:bold;color:#a71d5d;">:=</span><span style="color:#323232;"> git.PlainOpen(dir)
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#183691;">""</span><span style="color:#323232;">, </span><span style="color:#183691;">""</span><span style="color:#323232;">, err
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	tags, err </span><span style="font-weight:bold;color:#a71d5d;">:=</span><span style="color:#323232;"> repo.Tags()
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#183691;">""</span><span style="color:#323232;">, </span><span style="color:#183691;">""</span><span style="color:#323232;">, err
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">var </span><span style="color:#323232;">latestTag </span><span style="font-weight:bold;color:#a71d5d;">string
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">var </span><span style="color:#323232;">latestCommitTime time.Time
</span><span style="color:#323232;">
</span><span style="color:#323232;">	err </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> tags.ForEach(</span><span style="font-weight:bold;color:#a71d5d;">func</span><span style="color:#323232;">(ref </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;">plumbing.Reference) </span><span style="font-weight:bold;color:#a71d5d;">error</span><span style="color:#323232;"> {
</span><span style="color:#323232;">		tag :</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> ref.Name().Short()
</span><span style="color:#323232;">		commit, err :</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> repo.CommitObject(ref.Hash())
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil</span><span style="color:#323232;"> {
</span><span style="color:#323232;">			</span><span style="font-weight:bold;color:#a71d5d;">return</span><span style="color:#323232;"> err
</span><span style="color:#323232;">		}
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> commit.Committer.When.After(latestCommitTime) {
</span><span style="color:#323232;">			latestCommitTime </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> commit.Committer.When
</span><span style="color:#323232;">			latestTag </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> tag
</span><span style="color:#323232;">		}
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#0086b3;">nil
</span><span style="color:#323232;">	})
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#183691;">""</span><span style="color:#323232;">, </span><span style="color:#183691;">""</span><span style="color:#323232;">, err
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">return</span><span style="color:#323232;"> latestTag, latestCommitTime.Format(time.RFC1123Z), </span><span style="color:#0086b3;">nil
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">// GenerateRSS generates an RSS feed from the latest tags of the repositories
</span><span style="font-weight:bold;color:#a71d5d;">func </span><span style="font-weight:bold;color:#795da3;">GenerateRSS</span><span style="color:#323232;">() </span><span style="font-weight:bold;color:#a71d5d;">string </span><span style="color:#323232;">{
</span><span style="color:#323232;">	feed </span><span style="font-weight:bold;color:#a71d5d;">:=</span><span style="color:#323232;"> rss.Feed{
</span><span style="color:#323232;">		Title:       </span><span style="color:#183691;">"Latest Tags from Git Repositories"</span><span style="color:#323232;">,
</span><span style="color:#323232;">		Link:        </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">rss.Link{Href: </span><span style="color:#183691;">"http://example.com/"</span><span style="color:#323232;">},
</span><span style="color:#323232;">		Description: </span><span style="color:#183691;">"This feed provides the latest tags from a list of git repositories."</span><span style="color:#323232;">,
</span><span style="color:#323232;">		Created:     time.Now(),
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">for </span><span style="color:#323232;">_, repo </span><span style="font-weight:bold;color:#a71d5d;">:= range</span><span style="color:#323232;"> Repositories {
</span><span style="color:#323232;">		tag, date, err </span><span style="font-weight:bold;color:#a71d5d;">:= </span><span style="color:#323232;">FetchLatestTag(repo.URL)
</span><span style="color:#323232;">		</span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">			log.Printf(</span><span style="color:#183691;">"Error fetching latest tag for repository </span><span style="color:#0086b3;">%s</span><span style="color:#183691;">: </span><span style="color:#0086b3;">%v</span><span style="color:#183691;">"</span><span style="color:#323232;">, repo.URL, err)
</span><span style="color:#323232;">			</span><span style="font-weight:bold;color:#a71d5d;">continue
</span><span style="color:#323232;">		}
</span><span style="color:#323232;">		feed.Items </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#62a35c;">append</span><span style="color:#323232;">(feed.Items, </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">rss.Item{
</span><span style="color:#323232;">			Title:       fmt.Sprintf(</span><span style="color:#183691;">"Latest tag for </span><span style="color:#0086b3;">%s</span><span style="color:#183691;">: </span><span style="color:#0086b3;">%s</span><span style="color:#183691;">"</span><span style="color:#323232;">, repo.URL, tag),
</span><span style="color:#323232;">			Link:        </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">rss.Link{Href: repo.URL},
</span><span style="color:#323232;">			Description: fmt.Sprintf(</span><span style="color:#183691;">"The latest tag for repository </span><span style="color:#0086b3;">%s</span><span style="color:#183691;"> is </span><span style="color:#0086b3;">%s</span><span style="color:#183691;">, created on </span><span style="color:#0086b3;">%s</span><span style="color:#183691;">."</span><span style="color:#323232;">, repo.URL, tag, date),
</span><span style="color:#323232;">			Created:     time.Now(),
</span><span style="color:#323232;">		})
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">var </span><span style="color:#323232;">rssFeed strings.Builder
</span><span style="color:#323232;">	rssFeed.WriteString(xml.Header)
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">if </span><span style="color:#323232;">err </span><span style="font-weight:bold;color:#a71d5d;">:=</span><span style="color:#323232;"> feed.Write(</span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">rssFeed); err </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#0086b3;">nil </span><span style="color:#323232;">{
</span><span style="color:#323232;">		log.Fatalf(</span><span style="color:#183691;">"Error generating RSS feed: </span><span style="color:#0086b3;">%v</span><span style="color:#183691;">"</span><span style="color:#323232;">, err)
</span><span style="color:#323232;">	}
</span><span style="color:#323232;">
</span><span style="color:#323232;">	</span><span style="font-weight:bold;color:#a71d5d;">return</span><span style="color:#323232;"> rssFeed.String()
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-weight:bold;color:#a71d5d;">func </span><span style="font-weight:bold;color:#795da3;">main</span><span style="color:#323232;">() {
</span><span style="color:#323232;">	rssFeed </span><span style="font-weight:bold;color:#a71d5d;">:= </span><span style="color:#323232;">GenerateRSS()
</span><span style="color:#323232;">	fmt.Println(rssFeed)
</span><span style="color:#323232;">}
</span>
bionicjoey ,

Probably not, since Git is federated and decentralized. There are no git “accounts”. Git asks for your name and email but those are basically meaningless unless the repository hosting platform does something with them like ties them to an account identity.

You could maybe use the GitHub activity view by also mirroring your projects from elsewhere onto GH

2xsaiko OP ,
@2xsaiko@discuss.tchncs.de avatar

There don’t have to be, it would be completely fine just filtering commits by author email. Or maybe even signing key.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines