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

Commit

Permalink
PR webhook cant work anyway cos of forks --nobuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Nov 5, 2023
1 parent 673163f commit 6d53eb1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 46 deletions.
82 changes: 41 additions & 41 deletions .github/workflow_data/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,49 +43,49 @@
url = event["compare"]
color = 16723712 if event["forced"] else 3669797

case "pull_request":
pr = event["pull_request"]
url = pr["html_url"]
branch = pr["base"]["ref"] + (
""
if pr["base"]["repo"]["full_name"] != pr["head"]["repo"]["full_name"]
else f" <- {pr['head']['ref']}"
)
name = pr["title"][:50] + ("..." if len(pr["title"]) > 50 else "")
title = f"Pull Request {event['action'].title()} ({branch}): {name}"
match event["action"]:
case "opened":
desc = (pr["body"][:2045] + "...") if len(pr["body"]) > 2048 else pr["body"]
color = 3669797
# case "pull_request":
# pr = event["pull_request"]
# url = pr["html_url"]
# branch = pr["base"]["ref"] + (
# ""
# if pr["base"]["repo"]["full_name"] != pr["head"]["repo"]["full_name"]
# else f" <- {pr['head']['ref']}"
# )
# name = pr["title"][:50] + ("..." if len(pr["title"]) > 50 else "")
# title = f"Pull Request {event['action'].title()} ({branch}): {name}"
# match event["action"]:
# case "opened":
# desc = (pr["body"][:2045] + "...") if len(pr["body"]) > 2048 else pr["body"]
# color = 3669797

fields.append(
{
"name": "Changed Files:",
"value": str(pr["changed_files"]),
"inline": True,
}
)
fields.append(
{
"name": "Added:",
"value": "+" + str(pr["additions"]),
"inline": True,
}
)
fields.append(
{
"name": "Removed:",
"value": "-" + str(pr["deletions"]),
"inline": True,
}
)
# fields.append(
# {
# "name": "Changed Files:",
# "value": str(pr["changed_files"]),
# "inline": True,
# }
# )
# fields.append(
# {
# "name": "Added:",
# "value": "+" + str(pr["additions"]),
# "inline": True,
# }
# )
# fields.append(
# {
# "name": "Removed:",
# "value": "-" + str(pr["deletions"]),
# "inline": True,
# }
# )

case "closed":
color = 16723712
case "reopened":
color = 16751872
case _:
sys.exit(1)
# case "closed":
# color = 16723712
# case "reopened":
# color = 16751872
# case _:
# sys.exit(1)

case "release":
match event["action"]:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: 'Webhook'

on:
push:
pull_request:
types:
- "opened"
- "closed"
- "reopened"
# pull_request:
# types:
# - "opened"
# - "closed"
# - "reopened"
release:
types:
- "published"
Expand Down

0 comments on commit 6d53eb1

Please sign in to comment.