How do I get notifications for commits to a GitHub repository?
Asked Answered
T

10

58

I'd like to know what kind of commits are being made to the Lithium framework so I can update (or rollback) when there is something major.

I'm already watching the repository, but from what I've been able to find, that only shows updates on the github dashboard.

Trudietrudnak answered 23/3, 2012 at 19:51 Comment(2)
Crosslinking this question for people who only want notifications about changes to a portion of the repo.Darb
related?: docs.github.com/en/repositories/…Shanahan
B
46

Subscribe to Github's RSS feed!
Choose your news feed (all watched repos), or only Lithium's commit history.

RSS are made for that ;-)

PS: I don't see how can you find that useful since there is a couple of commits made each day on various branches, some small typo fixes, others fix bugs, and others introduce new things...

Brilliant answered 24/3, 2012 at 3:55 Comment(4)
The typo and bug fixes aren't what concerns me. I'm building live sites and there have been instances of rollbacks, I find it important to keep up with how the repo is changing.Trudietrudnak
It seems github doesn't put out an rss link. I think this might work though: github.com/UnionOfRAD/lithium/commits/master.atom. Found the answer on another question: #7354038Trudietrudnak
From the commits tab on Github, your can grab the feed. Master branch feed is a good candidate to follow changesBrilliant
If you're looking for push notifications (i.e. notifications on your phone or pc versus email notifications), you can check out my answer below #9846155Shults
A
26

I just found out by accident that you can easily manage to achieve this:

  • fork the project (if you haven't done it yet)
  • create a pull request for yourself from the selected branch, e.g. from master of head project to master of your fork:
    • base repository: your/project ; base: master <-- head repository: original/project ; compare: master
  • do NOT merge this pull request
  • under the Email section of your Notifications settings enable:
    • Comments on Issues and Pull Requests
    • Pull Request reviews
    • Pull Request pushes

That's it. You will receive email notifications about every commit on master branch.

Acth answered 4/3, 2017 at 19:28 Comment(6)
Not sure how this should work. I tried it and don't get any notifications. Do I have to do any thing more than this?Foreordination
@rubo77, I've updated the solution with Notifications settings (otherwise your setup looks fine).Acth
Ah ok, this is about email notifications. I thought the notifications in the top right corner with the blue bell have the same settings. I will try if I get email notifications now...Foreordination
I think I get those too with this (but they disappear if you read your email).Acth
You may need to drop the last commit. In 2021 I can't open a PR that has an empty diff: "There isn’t anything to compare." So I cloned the repository, git reset HEAD~, git push --force. And then I was able to create the PR as suggested in this answer.Code
This is great, but unfortunately it removes the ability for your fork to stay sync'ed with upstream. Which would not be too bad if github allowed you to have multiple forks (which would be useful anyway for other purposes, but I digress....) so you could use one fork to get notifications and the other to do work, but sadly github does not let you create multiple forks. What a PITA just getting some notifications!Ibnrushd
M
15

In addition to the other suggestions, you might try HubNotify for e-mail notifications.

Mercerize answered 24/3, 2012 at 5:12 Comment(2)
This gives notifications for new tags, not new commits, according to their own description.Lewls
I added an answer for commits available here: #9846155Shults
W
14

Go to your github project -> Settings -> notifications.

Add any address you want to notify when commits are done.

Wednesday answered 23/4, 2019 at 20:7 Comment(1)
This only works if you have admin privileges for that repository (see help.github.com/en/articles/…)Incus
S
10

You can leverage the GitHub Events API to perform such task and retrieve a JSON formatted response.

Note: In order to retrieve the commits, you'll have to filter out the events of type PushEvents.

Below a quick sample

$(function() {
    $.getJSON('https://api.github.com/repos/UnionOfRAD/lithium/events?callback=?', function(data) {
        var list = $('#push-events');

        $.each(data.data, function(key, val) {
            if (val.type == "PushEvent") {
                $.each(val.payload.commits, function(key2, val2) {
                    list.append('<li id="' + val2.sha + '"><a href="https://github.com/UnionOfRAD/lithium/commit/' + val2.sha + '">'
                                + val2.message + '</a> [' + val.actor.login + ' @ ' + val.created_at + ']</li>');
                });
            }
        });
        
        if (list.children().size() == 0) {
            list.append('<li>No pushes in last ' + data.data.length + ' events.</li>');
        }
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<ul id="push-events"></ul>
Shelves answered 23/3, 2012 at 21:13 Comment(2)
so I'm guessing that there isn't an event or notification setting I can just check off?Trudietrudnak
Unfortunately, there is no way to filter the events while invoking the API. This has to be performed as a post process step once the result is recieved.Shelves
E
6

Disclaimer: I'm the original author.

This project allows you to get an e-mail when a commit gets pushed on a repository you are watching (on any branch).

Explaination: gicowa is a command-line tool written in python that lists all last commits on all GitHub repos you are watching. This tool can send its output via e-mail and can be called from your crontab. Doing that makes you receive an e-mail notification each time a commit gets pushed on a GitHub repo you are watching.

Euphonic answered 30/12, 2015 at 12:14 Comment(0)
N
2

You go into Settings > Integrations & services for the GitHub repository and add an Email service. See Choosing the types of notifications you receive.

Nacreous answered 7/10, 2017 at 17:8 Comment(2)
Services are being deprecated. developer.github.com/changes/…Disremember
Thanks for the deprecation info. An alternative to get an E-mail for seeing commits to repos one is watching is described in this link using the RSS feed from GitHub and IFTTT (setting up with OAuth if the repository is private) or one can of course use an RSS feed reader.Nacreous
M
1

I used Devhubapp, downloaded the desktop version and set notifications to my repositories and it works just fine! Maybe it can help users that find this topic recently.

Milkweed answered 14/4, 2022 at 1:50 Comment(0)
S
0

You can use GitHub webhooks and set it up with a push notification API. This is free and easy to do.

Spontit is an example of a free API that enables you to do this.

For a tutorial, see this video.

Written instructions are available in the README here.

Shults answered 19/7, 2020 at 21:27 Comment(0)
F
0

You can use any more general website change monitoring tool to receive an email when a web page changes.

Make sure to monitor the url that lists the commits: https://github.com/*owner-name*/*repo-name*/commits/.

Fluff answered 15/2, 2023 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.