PR webhooks: Return 204 if PR gets created by somebody else than github-actions

This commit is contained in:
Alexandre Aubin 2021-09-22 15:32:22 +02:00 committed by GitHub
parent 6c15f5aba7
commit 50eb310429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

2
run.py
View file

@ -1059,7 +1059,7 @@ async def github(request):
if hook_infos["pull_request"]["user"]["login"] != "github-actions[bot]" \ if hook_infos["pull_request"]["user"]["login"] != "github-actions[bot]" \
or not hook_infos["pull_request"]["head"]["ref"].startswith("ci-auto-update-"): or not hook_infos["pull_request"]["head"]["ref"].startswith("ci-auto-update-"):
# Unauthorized # Unauthorized
abort(403, "Unauthorized") abort(204, "Nothing to do")
# Fetch the PR infos (yeah they ain't in the initial infos we get @_@) # Fetch the PR infos (yeah they ain't in the initial infos we get @_@)
pr_infos_url = hook_infos["pull_request"]["url"] pr_infos_url = hook_infos["pull_request"]["url"]