[coldfusion] Add automation (#172)
Co-authored-by: Marc Wrobel <marc.wrobel@gmail.com>
This commit is contained in:
33
src/coldfusion.py
Normal file
33
src/coldfusion.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import re
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from common import dates
|
||||||
|
from common import endoflife
|
||||||
|
|
||||||
|
URLS = [
|
||||||
|
"https://helpx.adobe.com/coldfusion/kb/coldfusion-10-updates.html",
|
||||||
|
"https://helpx.adobe.com/coldfusion/kb/coldfusion-11-updates.html",
|
||||||
|
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2016-updates.html",
|
||||||
|
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2018-updates.html",
|
||||||
|
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2021-updates.html",
|
||||||
|
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2023-updates.html"
|
||||||
|
]
|
||||||
|
|
||||||
|
PRODUCT = "coldfusion"
|
||||||
|
REGEX = r"[r|R]elease [d|D]ate[,|:]? (.*?)\).*?Build Number: (.*?)$"
|
||||||
|
|
||||||
|
print(f"::group::{PRODUCT}")
|
||||||
|
versions = {}
|
||||||
|
|
||||||
|
for response in endoflife.fetch_urls(URLS):
|
||||||
|
soup = BeautifulSoup(response.text, features="html5lib")
|
||||||
|
for p in soup.findAll("div", class_="text"):
|
||||||
|
text = p.get_text().strip().replace('\xa0', ' ')
|
||||||
|
matches = re.findall(REGEX, text, re.DOTALL | re.MULTILINE)
|
||||||
|
for m in matches:
|
||||||
|
date = dates.parse_date(m[0]).strftime("%Y-%m-%d")
|
||||||
|
version = m[1].strip().replace(",",".")
|
||||||
|
versions[version] = date
|
||||||
|
print(f"{version}: {date}")
|
||||||
|
|
||||||
|
endoflife.write_releases(PRODUCT, versions)
|
||||||
|
print("::endgroup::")
|
||||||
@@ -3,8 +3,6 @@ import calendar
|
|||||||
|
|
||||||
|
|
||||||
def parse_date(text, formats=frozenset([
|
def parse_date(text, formats=frozenset([
|
||||||
"%B %d, %Y", # January 1, 2020
|
|
||||||
"%b %d, %Y", # Jan 1, 2020
|
|
||||||
"%B %d %Y", # January 1 2020
|
"%B %d %Y", # January 1 2020
|
||||||
"%b %d %Y", # Jan 1 2020
|
"%b %d %Y", # Jan 1 2020
|
||||||
"%d %B %Y", # 1 January 2020
|
"%d %B %Y", # 1 January 2020
|
||||||
@@ -33,13 +31,14 @@ def parse_datetime(text, formats=frozenset([
|
|||||||
"%Y-%m-%d %H:%M:%S", # 2023-05-01 08:32:34
|
"%Y-%m-%d %H:%M:%S", # 2023-05-01 08:32:34
|
||||||
"%Y-%m-%dT%H:%M:%S", # 2023-05-01T08:32:34
|
"%Y-%m-%dT%H:%M:%S", # 2023-05-01T08:32:34
|
||||||
"%Y-%m-%d %H:%M:%S %z", # 2023-05-01 08:32:34 +0900
|
"%Y-%m-%d %H:%M:%S %z", # 2023-05-01 08:32:34 +0900
|
||||||
"%a, %d %b %Y %H:%M:%S %Z", # Wed, 01 Jan 2020 00:00:00 GMT
|
"%a %d %b %Y %H:%M:%S %Z", # Wed, 01 Jan 2020 00:00:00 GMT
|
||||||
"%Y-%m-%dT%H:%M:%S%z", # 2023-05-01T08:32:34+0900
|
"%Y-%m-%dT%H:%M:%S%z", # 2023-05-01T08:32:34+0900
|
||||||
]), to_utc=True) -> datetime:
|
]), to_utc=True) -> datetime:
|
||||||
"""Parse a given text representing a datetime using a list of formats,
|
"""Parse a given text representing a datetime using a list of formats,
|
||||||
optionally converting it to UTC.
|
optionally converting it to UTC.
|
||||||
"""
|
"""
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
|
text = text.replace(", ", " ") # so that we don't have to deal with commas in formats
|
||||||
for fmt in formats:
|
for fmt in formats:
|
||||||
try:
|
try:
|
||||||
date = datetime.strptime(text, fmt)
|
date = datetime.strptime(text, fmt)
|
||||||
|
|||||||
Reference in New Issue
Block a user