Skip to content

Instantly share code, notes, and snippets.

@TessaGit
Created September 29, 2015 16:08
Show Gist options
  • Save TessaGit/6f0e303749c22f76f594 to your computer and use it in GitHub Desktop.
Save TessaGit/6f0e303749c22f76f594 to your computer and use it in GitHub Desktop.
Workflow Tools Engineer Gist for Robert

Workflow Tools Engineer Screener

Thanks again for applying to the Workflow Tools Engineer job at GitHub! The purpose of this gist is to get a better sense of your technical skills and overall communication style.

Engineers at GitHub communicate primarily in written form, via GitHub Issues and Pull Requests. We expect our engineers to communicate clearly and effectively; they should be able to concisely express both their ideas as well as complex technical concepts.

Please complete the following exercise in as much detail as you feel comfortable with. It is purposefully open-ended, and we hope you take the opportunity to show us your familiarity with various technologies, tools, and techniques. Use any resources you'd like. It shouldn't take more than 15 minutes.

Exercise

An engineer has just submitted this new script to a repository of chat commands. The engineer left the following as a description of this new code:

Creates an issue on a given repository from chat. We can now type /issue foobar Banking Customers would like routing numbers highlighted, and an issue will be created on github/foobar with that title. Alternately, you can type /issue foobar 23 Still researching this, and a comment with the text "Still researching this" will be appended to issue 23 in github/foobar.

Spend a few minutes reviewing this code. Remember: you're talking to a person. Please use general comments and/or line comments.

You can leave your commnets in a comment on this gist, or fork it and leave inline comments. If you leave your comments in a comment, prefix line comments with a markdown blockquote of the line you're commenting on, like so:

> require 'bundler/setup'

Everybody hates bundler!

The code:

#!/usr/bin/env ruby

require 'bundler/setup'
require 'octokit'

if ARGV.empty?
  puts "Post new issues or, if given an issue id, add a comment."
  puts "Usage: gh-simple-issue REPO [ISSUEID] <text>"
  exit 1
end

token = ENV['HUBOT_GITHUB_TOKEN']
client = Octokit::Client.new(
  :login        => "hubot",
  :access_token => token
)

repo = issue = nil
if ARGV.length >= 3
  repo = ARGV[0]
  issue = ARGV[1]
  words = ARGV[2]
elsif ARGV.length >= 2
  repo = ARGV[0]
  words = ARGV[1]
end
nwo = "github/#{repo.downcase}"


if issue
  client.add_comment(nwo, issue, words)
else
  client.create_issue(nwo, "Opened from #{`hostname -s`.strip} by #{ENV["CAMPFIRE_USER"].strip}", words)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment