bin/githubomnifocus.rb
# This method is responsible for getting your assigned GitHub Issues and adding them to OmniFocus as Tasks
This method is responsible for getting your assigned GitHub Issues and adding them to OmniFocus as Tasks
This method is responsible for getting your assigned GitHub Issues and adding them to OmniFocus as Tasks
def add_github_issues_to_omnifocus (omnifocus_document)
	results = get_issues
	if results.nil?
		puts "No results from GitHub"
		exit
	end
	results.each do |issue_id, issue|
		pr        = issue["pull_request"] && !issue["pull_request"]["diff_url"].nil?
		number    = issue.number
		project   = issue.repository.full_name.split("/").last
		issue_id = "#{project}-##{number}"
		title     = "#{issue_id}: #{pr ? "[PR] " : ""}#{issue["title"]}"
		url       = "https://github.com/#{issue.repository.full_name}/issues/#{number}"
		note      = "#{url}\n\n#{issue["body"]}"
		task_name = title
		task_notes = note
		@props = {}
		@props['name'] = task_name
		@props['project'] = $opts[:project]
		@props['tag'] = $opts[:tag]
		@props['note'] = task_notes
		@props['flagged'] = $opts[:flag]
		add_task(omnifocus_document, @props)
	end
end
def add_github_issues_to_omnifocus ( omnifocus_document ) results = get_issues if results . nil? puts "No results from GitHub" exit end results . each do | issue_id , issue | pr = issue [ "pull_request" ] && ! issue [ "pull_request" ] [ "diff_url" ] . nil? number = issue . number project = issue . repository . full_name . split ( "/" ) . last issue_id = "#{project}-##{number}" title = "#{issue_id}: #{pr ? "[PR] " : ""}#{issue["title"]}" url = "https://github.com/#{issue.repository.full_name}/issues/#{number}" note = "#{url}\n\n#{issue["body"]}" task_name = title task_notes = note @props = { } @props [ 'name' ] = task_name @props [ 'project' ] = $opts [ :project ] @props [ 'tag' ] = $opts [ :tag ] @props [ 'note' ] = task_notes @props [ 'flagged' ] = $opts [ :flag ] add_task ( omnifocus_document , @props ) end end
This method is responsible for getting your assigned GitHub Issues and adding them to OmniFocus as Tasks
This method is responsible for getting your assigned GitHub Issues and adding them to OmniFocus as Tasks
# Get the open Jira issues assigned to you # Iterate through resulting issues. # Create the task notes with the GitHub Issue URL and issue body # Build properties for the Task
omnifocus_document