Showing 1 post tagged facebook
From The Engineering Team: Adding the “Post Commit” action to the Open Graph
Continuing on our expansion into the wonderful world of the Open Graph, we are now happy to bring your open source commits into Facebook! What this means is that your Facebook timeline can now include some details on how much code you have been pushing, and here is mine after I created a new project called aws-ssh:

Probably the most interesting time of the project is when it is just starting, and you get to explore what is possible. When putting data in the Open Graph, you have to model the data around actions that people would do in real life. For example, let’s take this simple sentence: “A developer writes code”. Awesome, sounds like something we can all identify with. But wait, “writing code” is a bit hard to quantify. So let’s see how code gets written:
- Close reddit tab (see ya latter kittens!)
- Open up vim
- Write some code
- Test written code
- Commit code
- Push commit
- Release to production
- PROFIT
Alright, so “commit code” and “push commit” sound like key points that can be quantified. I was actually going to go with “commit code”, but the object needs to be a countable noun due to the way Facebook creates the sentences (“<verb> a(n) <object>”). So that is how I came up with “push” as the action and “commit” as the object.
Next up, we need to look at what attributes can be associated with a pushed commit. These were actually pretty easy to figure out, as we are using Github’s API and they give us all the attributes that can be seen in their Repo Commits API. So to be safe, I do what any sane engineer would do, just horde all the data in the database! Currently a commit object will have the following attributes in the Open Graph:
- Lines added
- Lines deleted
- Total number of lines changed
- Number of files changed
And then I realized that there was an object that could be related to the commit — the repository. So I ended up creating a new Open Graph object, and added the Repository as an attribute of the Commit as well. Currently the attributes for the repository are the number of watchers and number of forks on Github. That way when you see a commit, you can interact with the repository as well, like this:

In addition to this tech post, I created a walkthrough video that I want you to see. It really is magical how smooth everything works and I can’t wait to start seeing developer stats inside Facebook. So connect with Facebook and link your Github account right now! Without further ado, enjoy the walkthrough video:
Jon Keating
Sr. Software Engineer, Geeklist
http://geekli.st/emostar
