Skip to content

Commit be917e5

Browse files
committed
add /attempt command
1 parent 1cc2da3 commit be917e5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/algora/integrations/github/command.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ defmodule Algora.Github.Command do
99
bounty: "/bounty <amount>",
1010
tip: "/tip <amount> @username or /tip @username <amount>",
1111
claim: "/claim <issue-ref> (e.g. #123, repo#123, owner/repo#123, or full GitHub URL)",
12-
split: "/split @username"
12+
split: "/split @username",
13+
attempt: "/attempt <issue-ref> (e.g. #123, repo#123, owner/repo#123, or full GitHub URL)"
1314
}
1415

1516
def commands do
@@ -79,6 +80,16 @@ defmodule Algora.Github.Command do
7980
|> tag(:claim)
8081
|> label(@usage.claim)
8182
end
83+
84+
def attempt_command do
85+
"/attempt"
86+
|> string()
87+
|> ignore()
88+
|> concat(ignore(whitespace()))
89+
|> concat(ticket_ref())
90+
|> tag(:attempt)
91+
|> label(@usage.attempt)
92+
end
8293
end
8394

8495
defparsec(:parse_raw, Helper.commands())

lib/algora_web/controllers/webhooks/github_controller.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ defmodule AlgoraWeb.Webhooks.GithubController do
140140
end
141141
end
142142

143+
defp execute_command(event_action, {:attempt, args}, author, _params)
144+
when event_action in ["issue_comment.created", "issue_comment.edited"] do
145+
ticket_ref = args[:ticket_ref]
146+
147+
# TODO: implement
148+
dbg("#{author["login"]} is attempting #{ticket_ref}")
149+
end
150+
143151
defp execute_command(event_action, {:claim, args}, author, params)
144152
when event_action in ["pull_request.opened", "pull_request.reopened", "pull_request.edited"] do
145153
installation_id = params["installation"]["id"]

0 commit comments

Comments
 (0)