private static void addAuthHeaderIfNeeded(URLConnection urlConnection) {
		String auth = null;
		if (isAGithubUrl(urlConnection) && System.getenv().containsKey("GITHUB_TOKEN")) {
			auth = "token " + System.getenv("GITHUB_TOKEN");
		} else {
			URL url = urlConnection.getURL();
			String username;
			String password;
			if (url.getUserInfo() != null) {
				String[] credentials = url.getUserInfo().split(":", 2);
				username = PropertiesValueResolver.replaceProperties(credentials[0]);
				password = credentials.length > 1 ? PropertiesValueResolver.replaceProperties(credentials[1]) : "";
			} else {
				username = System.getenv(JBANG_AUTH_BASIC_USERNAME);
				password = System.getenv(JBANG_AUTH_BASIC_PASSWORD);
			}
			if (username != null && password != null) {
				String id = username + ":" + password;
				String encodedId = Base64.getEncoder().encodeToString(id.getBytes(StandardCharsets.UTF_8));
				auth = "Basic " + encodedId;
			}
		}
		if (auth != null) {
			urlConnection.setRequestProperty("Authorization", auth);
		}
	}
Downloads a file from a URL

@param fileURL HTTP URL of the file to be downloaded
@param saveDir path of the directory to save the file
@param timeOut the timeout in milliseconds to use for opening the connection.
               0 is an infinite timeout while -1 uses the defaults
@return Path to the downloaded file
@throws IOException
src/main/java/dev/jbang/util/Util.java