Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit 8158b24

Browse files
author
Joshua Wehner
committed
Cleanup and move common code to common.rb
1 parent 2f72bce commit 8158b24

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

common.rb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
REGEX = %r{github\.com/([^/]+/[^/]+)/issues/(\d+)}
2+
# https://github.com/username/reponame/issues/2
3+
# -> username/reponame, 2
4+
def parse_issue_url(url)
5+
if md = REGEX.match(url)
6+
[md[1], md[2]]
7+
end
8+
end

create-assigned-issue

+1-10
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,13 @@ BANNER
1010
$stderr.sync = true
1111
require 'octokit'
1212
require 'optparse'
13+
require './common'
1314

1415
file = __FILE__
1516
issue_url = ARGV.first
16-
token = ENV['TOKEN']
1717

1818
abort banner if !issue_url || issue_url == '-h'
1919

20-
REGEX = %r{github\.com/([^/]+/[^/]+)/issues/(\d+)}
21-
# https://github.com/username/reponame/issues/2
22-
# -> username/reponame, 2
23-
def parse_issue_url(url)
24-
if md = REGEX.match(url)
25-
[md[1], md[2]]
26-
end
27-
end
28-
2920
Octokit.auto_paginate = true
3021

3122
client = Octokit::Client.new :access_token => ENV['GITHUBTEACHER_TOKEN']

0 commit comments

Comments
 (0)