Last active
January 16, 2020 11:16
-
-
Save evrardjp/7370c060886322fbc3d022ff8d6d936e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# put yourself in the folder of the _service file, and run this. | |
# use the output for writing your osc vc or change file | |
import os | |
import re | |
import requests | |
from urllib.parse import urlparse | |
with open('_service', 'r') as sf: | |
sfcontent = sf.read() | |
match_url=re.search('.*<param.*url.*>(.*)</param>.*', sfcontent, re.MULTILINE) | |
url = match_url.group(1) | |
parsed_url=urlparse(url) | |
repo=parsed_url.path.split('.git')[0][1:] | |
match_revision=re.search('.*<param.*revision.*>(.*)</param>.*', sfcontent, re.MULTILINE) | |
revision = match_revision.group(1) | |
api_url = 'https://api.github.com/repos/{repo}/releases/tags/{revision}'.format(repo=repo, revision=revision) | |
r = requests.get(api_url) | |
print(r.json()['body']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment