Skip to content

Commit e3589d2

Browse files
committed
handle all kinds of ticket_refs
1 parent 22973fb commit e3589d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/algora_web/controllers/webhooks/github_controller.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,20 @@ defmodule AlgoraWeb.Webhooks.GithubController do
116116
defp execute_command({:claim, args}, author, params) when not is_nil(args) do
117117
installation_id = params["installation"]["id"]
118118
pull_request = params["pull_request"]
119+
repo = params["repository"]
120+
121+
ticket_ref = %{
122+
owner: args[:ticket_ref][:owner] || repo["owner"]["login"],
123+
repo: args[:ticket_ref][:repo] || repo["name"],
124+
number: args[:ticket_ref][:number]
125+
}
119126

120127
with {:ok, token} <- Github.get_installation_token(installation_id),
121128
{:ok, user} <- Workspace.ensure_user(token, author["login"]) do
122129
Bounties.claim_bounty(
123130
%{
124131
user: user,
125-
ticket_ref: %{owner: args[:owner], repo: args[:repo], number: args[:number]},
132+
ticket_ref: ticket_ref,
126133
pull_request: pull_request
127134
},
128135
installation_id: installation_id

0 commit comments

Comments
 (0)