-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Similar to chef-infra-client and chef-infra-server.
- Loading branch information
1 parent
d447149
commit 0a2bd46
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from bs4 import BeautifulSoup | ||
from common import dates, http, releasedata | ||
from common.git import Git | ||
|
||
"""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. | ||
""" | ||
|
||
with releasedata.ProductData("chef-inspec") as product_data: | ||
rn_response = http.fetch_url("https://docs.chef.io/release_notes_inspec/") | ||
rn_soup = BeautifulSoup(rn_response.text, features="html5lib") | ||
released_versions = [h2.get('id') for h2 in rn_soup.find_all('h2', id=True) if h2.get('id')] | ||
print(released_versions) | ||
|
||
git = Git("https://github.com/inspec/inspec.git") | ||
git.setup(bare=True) | ||
|
||
versions = git.list_tags() | ||
for version, date_str in versions: | ||
sanitized_version = version.replace("v", "") | ||
if sanitized_version in released_versions: | ||
date = dates.parse_date(date_str) | ||
product_data.declare_version(sanitized_version, date) |