This script is using the GitHub CLI with the GraphQL API in order to retrieve releases. The reasons are:
- using 'gh release list' does not return all the releases
- using the API, directly or via GitHub CLI, is slow, produces a lot of 502 errors, and is harder due to pagination.
- using the GraphQL API directly is hard due to pagination.
- using a library, such as graphql-python, is sightly harder than using the GitHub CLI (and still requires a GITHUB_TOKEN).
Access to the GitHub token is required when using GitHub CLI, hence the update.yml workflow update.
Fetch Java versions with their dates from https://www.java.com/releases/.
This script is using a new dependency: requests-html (https://requests-html.kennethreitz.org/). This is because https://www.java.com/releases/ needs JavaScript to render correctly. And for this to work requests-html automatically downloads Chromium because of its dependency to pyppeteer.
Chromium is downloaded into PYPPETEER_HOME, so the workflow has been modified to set this directory as a subdirectory of ~/.cache. Note that declaring the same environment variable from the python script does not work.
If you push a branch to the main repo, and a branch here with the same
name, then the update script here will use the same branch name instead
of using `main`. This way, we can keep 2 branches in sync and then merge
them.
If a branch does not exist, we'll fallback to cloning master instead