@@ -244,34 +244,38 @@ defmodule AlgoraWeb.Webhooks.GithubController do
244244 end
245245 end
246246
247- unpaid_bounties =
248- Enum . filter (
249- bounties ,
250- & case autopay_result do
251- :ok -> & 1 . id != autopayable_bounty . id
252- _ -> true
253- end
254- )
247+ if autopay_result do
248+ autopay_result
249+ else
250+ unpaid_bounties =
251+ Enum . filter (
252+ bounties ,
253+ & case autopay_result do
254+ :ok -> & 1 . id != autopayable_bounty . id
255+ _ -> true
256+ end
257+ )
255258
256- sponsors_to_notify =
257- unpaid_bounties
258- |> Enum . map ( & ( & 1 . creator || & 1 . owner ) )
259- |> Enum . map_join ( ", " , & "@#{ & 1 . provider_login } " )
260-
261- if unpaid_bounties != [ ] do
262- names =
263- claims
264- |> Enum . map ( fn c -> "@#{ c . user . provider_login } " end )
265- |> Algora.Util . format_name_list ( )
266-
267- Github . create_issue_comment (
268- token ,
269- primary_claim . target . repository . user . provider_login ,
270- primary_claim . target . repository . name ,
271- primary_claim . target . number ,
272- "🎉 The pull request of #{ names } has been merged. The bounty can be rewarded [here](#{ Claim . reward_url ( primary_claim ) } )" <>
273- if ( sponsors_to_notify == "" , do: "" , else: "\n \n cc #{ sponsors_to_notify } " )
274- )
259+ sponsors_to_notify =
260+ unpaid_bounties
261+ |> Enum . map ( & ( & 1 . creator || & 1 . owner ) )
262+ |> Enum . map_join ( ", " , & "@#{ & 1 . provider_login } " )
263+
264+ if unpaid_bounties != [ ] do
265+ names =
266+ claims
267+ |> Enum . map ( fn c -> "@#{ c . user . provider_login } " end )
268+ |> Algora.Util . format_name_list ( )
269+
270+ Github . create_issue_comment (
271+ token ,
272+ primary_claim . target . repository . user . provider_login ,
273+ primary_claim . target . repository . name ,
274+ primary_claim . target . number ,
275+ "🎉 The pull request of #{ names } has been merged. The bounty can be rewarded [here](#{ Claim . reward_url ( primary_claim ) } )" <>
276+ if ( sponsors_to_notify == "" , do: "" , else: "\n \n cc #{ sponsors_to_notify } " )
277+ )
278+ end
275279 end
276280
277281 :ok
0 commit comments