Skip to content

Commit

Permalink
update pythom CI
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Oct 12, 2023
1 parent 19b82de commit 129f1fb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -16,10 +16,10 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7.18
uses: MatteoH2O1999/setup-python@v1
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7.18
python-version: '3.10'
- name: Set up Java 11
uses: actions/setup-java@v1
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -16,10 +16,10 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7.18
uses: MatteoH2O1999/setup-python@v1
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7.18
python-version: '3.10'
- name: Set up Java 11
uses: actions/setup-java@v1
with:
Expand Down
47 changes: 24 additions & 23 deletions CI/ghApiClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import os
import time
import urllib2
import httplib
import urllib.request, urllib.error, urllib.parse
import http.client
import json

GH_BASE_URL = "https://api.github.com/"
Expand All @@ -13,46 +13,47 @@

def readUrl(name):
try:
request = urllib2.Request(GH_BASE_URL + name)
request = urllib.request.Request(GH_BASE_URL + name)
request.add_header("Authorization", GH_AUTH)
content = urllib2.urlopen(request).read()
content = urllib.request.urlopen(request).read()
jcont = json.loads(content)
return jcont;
except urllib2.HTTPError as e:
print ('HTTPError = ' + str(e.code))
return jcont
except urllib.error.HTTPError as e:
print(('HTTPError = ' + str(e.code)))
raise e
except urllib2.URLError as e:
print ('URLError = ' + str(e.reason))
except urllib.error.URLError as e:
print(('URLError = ' + str(e.reason)))
raise e
except httplib.HTTPException as e:
print ('HTTPException = ' + str(e))
except http.client.HTTPException as e:
print(('HTTPException = ' + str(e)))
raise e
except Exception:
import traceback
print ('generic exception: ' + traceback.format_exc())
print(('generic exception: ' + traceback.format_exc()))
raise IOError

def postUrl(name, body):
global GH_BASE_URL
try:
time.sleep(0.05)
request = urllib2.Request(GH_BASE_URL + name)
request = urllib.request.Request(GH_BASE_URL + name)
request.add_header("Authorization", GH_AUTH)
request.add_header("Accept", "application/vnd.github.v3+json")
content = urllib2.urlopen(request, body).read()
content = urllib.request.urlopen(request, body).read()
jcont = json.loads(content)
return jcont;
except urllib2.HTTPError as e:
print ('HTTPError = ' + str(e.code))
print (str(e))
return jcont
except urllib.error.HTTPError as e:
print(('HTTPError = ' + str(e.code)))
print((str(e)))
raise e
except urllib2.URLError as e:
print ('URLError = ' + str(e.reason))
except urllib.error.URLError as e:
print(('URLError = ' + str(e.reason)))
raise e
except httplib.HTTPException as e:
print ('HTTPException = ' + str(e))
except http.client.HTTPException as e:
print(('HTTPException = ' + str(e)))
raise e
except Exception:
import traceback
print ('generic exception: ' + traceback.format_exc())
print(('generic exception: ' + traceback.format_exc()))
raise IOError

15 changes: 8 additions & 7 deletions CI/releaseNotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def allPulls(releaseDate):
baseurl = "https://api.github.com/repos/swagger-api/swagger-core/pulls/"
content = ghApiClient.readUrl('repos/swagger-api/swagger-core/pulls?state=closed&base=master&per_page=100')
for l in content:
stripped = l["url"][len(baseurl):]
mergedAt = l["merged_at"]
if mergedAt is not None:
if datetime.strptime(mergedAt, '%Y-%m-%dT%H:%M:%SZ') > releaseDate:
if not l['title'].startswith("bump snap"):
result += '\n'
result += "* " + l['title'] + " (#" + stripped + ")"
stripped = l["url"][len(baseurl):]
mergedAt = l["merged_at"]
if mergedAt is not None:
if datetime.strptime(mergedAt, '%Y-%m-%dT%H:%M:%SZ') > releaseDate:
if not l['title'].startswith("bump snap"):
result += '\n'
result += "* " + l['title'] + " (#" + stripped + ")"
return result


Expand Down Expand Up @@ -49,3 +49,4 @@ def main(last_release, release_title, tag):

# here start main
main(sys.argv[1], sys.argv[2], sys.argv[3])

0 comments on commit 129f1fb

Please sign in to comment.