[chef-versions] Add auto method (#554)
Also remove `chef-inspec` and `chef-infra` as they don't work anymore following changes on https://docs.chef.io/.
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
from common import dates, github, http
|
||||
from common.releasedata import ProductData, config_from_argv
|
||||
|
||||
"""Fetch released versions from docs.chef.io and retrieve their date from GitHub.
|
||||
docs.chef.io needs to be scraped because not all tagged versions are actually released.
|
||||
|
||||
More context on https://github.com/endoflife-date/endoflife.date/pull/4425#discussion_r1447932411.
|
||||
"""
|
||||
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
html = http.fetch_html(config.url)
|
||||
released_versions = [h2.get('id') for h2 in html.find_all('h2', id=True) if h2.get('id')]
|
||||
|
||||
for release in github.fetch_releases("inspec/inspec"):
|
||||
sanitized_version = release.tag_name.replace("v", "")
|
||||
if sanitized_version in released_versions:
|
||||
date = dates.parse_datetime(release.published_at)
|
||||
product_data.declare_version(sanitized_version, date)
|
||||
@@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from common import dates, http
|
||||
from common.git import Git
|
||||
from common.releasedata import ProductData, config_from_argv
|
||||
@@ -11,11 +13,18 @@ More context on https://github.com/endoflife-date/endoflife.date/pull/4425#discu
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
html = http.fetch_html(config.url)
|
||||
released_versions = [h2.get('id') for h2 in html.find_all('h2', id=True) if h2.get('id')]
|
||||
|
||||
released_versions = []
|
||||
for h2 in html.find_all('h2'):
|
||||
title = h2.get_text(strip=True)
|
||||
match = config.first_match(title)
|
||||
if not match:
|
||||
logging.warning(f"Skipping '{title}', no match found")
|
||||
continue
|
||||
released_versions.append(config.render(match))
|
||||
|
||||
git = Git(config.data.get('repository'))
|
||||
git.setup(bare=True)
|
||||
|
||||
versions = git.list_tags()
|
||||
for version, date_str in versions:
|
||||
version = version.startswith("v") and version[1:] or version # Remove 'v' prefix if present
|
||||
Reference in New Issue
Block a user