42

Are there service hooks for GitHub wiki repositories? Is there some other mechanism that GitHub provides for me to track wiki edits?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Eric Bloch
  • 2,882
  • 2
  • 20
  • 26

2 Answers2

34

Push approach: Within the GitHub API documentation, you can find documentation about setting up service hooks which can be triggered for one or more events. The gollum event is especially raised any time a wiki page is updated.

JSON-based pull approach: You can also leverage the Events HTTP API to retrieve a JSON formated output of what happens on GitHub, then apply some filtering in order to isolate the events of type GollumEvent.

Below a quick jQuery-based sample

<html>
    <head>
        <title>Gollum events</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript">
            $(function() {
                $.getJSON('https://api.github.com/repos/holman/spark/events?callback=?', function(data) {

                    var list = $('#gollum-events');

                    $.each(data.data, function(key, val) {
                        if (val.type == "GollumEvent") {
                            $.each(val.payload.pages, function(key2, val2) {
                                list.append('<li id="' + key + '.' + key2 + '"><a href="' + val2.html_url + '">' + val2.page_name + '</a> [' + val.actor.login + ' @ ' + val.created_at + ']</li>');
                            });
                        }
                    });
                });
            });
        </script>
    </head>
    <body>
        <ul id="gollum-events"/>
    </body>
</html>

Atom based pull approach: Last but not least, you can subscribe to the wiki changes atom feed. Go to the GitHub Wiki section of the repository, select the Pages sub tab, hover onto the orange icon, copy the link and paste into your favorite RSS reader.

Subscribe to changes

Update:

It looks like the RSS feed icon is no longer displayed for a wiki.

However, you can still build the URL by yourself

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
nulltoken
  • 64,429
  • 20
  • 138
  • 130
  • The push approach is what I was looking for, thanks. Next request would be some nice way to render the diffs for edits - similar to what you can see using the normal github ui. – Eric Bloch Dec 26 '11 at 23:26
  • Is it still possible to get an Atom feed of a repo's recent wiki edits? I don't see an RSS icon at https://github.com/holman/spark/wiki/_pages – Philip Durbin Oct 25 '13 at 12:41
  • 3
    @PhilipDurbin I've updated the answer with the syntax to guess by yourself the rss feed link. – nulltoken Oct 25 '13 at 19:18
3

I set up a Jenkins job to pull our GitHub wiki from https://github.com/IQSS/dvn.wiki.git with a build trigger of @daily. In a build step, I'm executing a shell command like this to email us:

echo "The DVN wiki on GitHub has been updated. Please check for new content at https://github.com/IQSS/dvn/wiki/_history" | mail -s "[dvn-wiki-notifications] update detected" dvn@example.com

Here's the job if anyone cares to see: https://build.hmdc.harvard.edu:8443/job/dvn-wiki-notifications/

Philip Durbin
  • 4,042
  • 2
  • 25
  • 36