'.get_bloginfo('name').'

Andrew Hall

0 comments

DDD EA – Session 1 – GitHub Automation

Please excuse all typos/grammar mistakes – this was done live during the talk.

This talk was by Forbes Lindesay.

If you want todo something simple with GitHub then some browser plugins are available but if you want to do more, use the REST API

*sometimes returns 404 when should return 403 – this is done on purpose for security

To automate:

1) generate a new oauth token – use developer for tools for other people – personal for yourself

2) choose the access rights

3) add oauth token to your chosen code/library, (you can use GitHub-basic if using JavaScript) choosing API version and sync options as per your needs

The GitHub API, gives you low level access to functionality, but this means that you have to do more to do simple tasks. Eg: you have to mess about with shas and trees rather than just saying commit(files)

Forbes then gave an example of getting a list of contributors to a particular repo by calling the API followed by an example of doing a commit via JavaScript.

When maintaining the JADE library on GitHub, there was an old piece of functionality that used some strange code to generate HTML doctype which was subsequently changed. but some people liked the old way – how can we solve this issue for people that want it the old way with keeping the code the same?

We can do this with automation on public repos. Create code to check peoples public repos and do the replacement afterwards, instead of part of the library and we can fix peoples deprecated code.

1) iterate through their repos.
2) find any relevant repos that contain deprecated code
3) branch with changes
4) create pull request on each repo with description about fixing the deprecated features

This GitHub automation bot has been run live on GitHub and many pull requests have been created. Some have been accepted and many have been closed. When doing something like this before, 20% of pull requests had been accepted.

However, there are potential problems with this.

Forbes describes a way to parse messages from the ES discuss mailing list into a better readable format.
He tried various approaches to this, eventually settling on using GitHub as the back end as this provided unlimited storage and built in support for moderation and editing.
He created a bot to pull data from the discussion list and inserted the data into GitHub.
This worked well for 6 months, but they realised that GitHub was too slow to do what they wanted so they replaced that with a normal database instead.

Ideas for GitHub automation;

1) open source report card
Takes a GitHub user and generates data on that user like languages and when they commit as well as similarities. Also draws graphs.

2) gitspective
Takes GitHub commits and issues and makes them into a Facebook like timeline

3) Huboard
Commercial project to pull in issues from GitHub for use on kanban board

Forbes other ideas:

1) personal task list
Read oldest first issues from GitHub to know what to do

2) automatically public new versions
When a change is made, automatically push to a CDN

3) automating patching of security vulnerabilities
Search all public repos for known security flaws, automatically patch and create pull request.

In summary: Build more bots!

Leave a comment or tweet me