On Thu, Jun 15, 2023 at 11:59 AM Dima Pasechnik <dimp...@gmail.com> wrote:

> Well, I'll try if I can trigger version 10.0. I also noticed there are two
>> webhooks in the github repo. Not sure what to do, I'll leave it as it is
>> for now.
>>
>
> What webhooks?
>
>
So, anyone who has access to the github repo settings can trigger zenodo.
The URL of the webhook has a token, at the end as a query param.
Zenodo added these webhooks, they're here:
https://github.com/sagemath/sage/settings/hooks

The *second* one is the one added by me, supposedly.
When you click on it and open the tab "Recent Deliveries", it just says
"ping".
The other one has more activity. Maybe that's the broken one, IDK.

In any case, I coped the token from the second webhook, and ran this:

import requests
from pprint import pprint
repo = "sagemath/sage"
token = "SECRET RANDOM STRING"
headers = {"Accept": "application/vnd.github.v3+json"}
repo_response = requests.get(f"https://api.github.com/repos/{repo}";,
headers=headers)
release_response = requests.get(f"
https://api.github.com/repos/{repo}/releases";, headers=headers)
releases = release_response.json()
# only the latest one
release = releases[0]
pprint(release)
payload = {"action": "published", "release": release, "repository":
repo_response.json()}
# this should say something with "200"
print(requests.post(
    f"
https://zenodo.org/api/hooks/receivers/github/events/?access_token={token}";,
    json=payload
))

I.e. that POST request above must be what github would do, when something
happens with releases. So, this just mimics what github would do, that's
all.

*Long story short: as a result, we have this now:
https://zenodo.org/record/8042261 <https://zenodo.org/record/8042261>*

-- Harald

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAGG4CB4i--_87uvDaQ1EqcBmaCahhRioYnUatyaYQNaxk5j6Gw%40mail.gmail.com.

Reply via email to