How do I get notifications for commits to a repository?

爱⌒轻易说出口 提交于 2019-12-03 10:44:59

问题


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.


回答1:


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...




回答2:


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




回答3:


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 fork: original/project ; base: master ; head fork: your/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.




回答4:


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

  • syntax: GET /repos/:user/:repo/events
  • example: https://api.github.com/repos/UnionOfRAD/lithium/events

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>



回答5:


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.




回答6:


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

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




回答7:


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



来源:https://stackoverflow.com/questions/9845655/how-do-i-get-notifications-for-commits-to-a-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!