-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache Swift Evolution JSON file locally on disk #5
Comments
You may already be thinking along these lines but if you use the GitHub API endpoint at: It will return the commit of the main branch. You can check it against the The GitHub API docs are here: And something like this should work for decoding the result (excluding a lot of additional branch information) from the API: struct GHBranch: Codable {
let name: String
let commit: Commit
struct Commit: Codable {
let sha: String
}
} |
@dempseyatgithub That's a good idea, thanks! |
I've been running a few informal tests over the past few days to check the HTTP caching behavior of the server $ curl --head "https://download.swift.org/swift-evolution/v1/evolution.json"
HTTP/1.1 200 OK
…
ETag: "D876AE18FBE60E698072F81210C48EBB"
Cache-Control: max-age=3600, public
Last-Modified: Wed, 22 May 2024 13:38:28 GMT
… Specifically, it looks like we can perform a HEAD request and rely on the This strikes me as the better approach than asking a different source of truth (the GitHub API). It means we have to store the HTTP response headers separately, but that's not a big deal. |
Thanks for doing that investigation @ole. That seems better than what I had suggested, I will remember this technique for my own projects. |
Currently, we download the JSON file on every invocation of the workflow, which is really wasteful and slow.
The text was updated successfully, but these errors were encountered: