Add prompt for updating GitHub databases#3079
Conversation
d434636 to
d03082d
Compare
d03082d to
a0295d6
Compare
starcke
left a comment
There was a problem hiding this comment.
Looks good, mostly just minor comments and thoughts.
| const databaseUpdates = Array.from(newestExistingDatabasesByLanguage.values()) | ||
| .map((newestExistingDatabase): DatabaseUpdate | null => { | ||
| const origin = newestExistingDatabase.origin; | ||
| if (origin?.type !== "github") { |
There was a problem hiding this comment.
Isnt this already the case from the filter above? or is there some other way it can be another type?
There was a problem hiding this comment.
Yes, this is already the case. However, TypeScript doesn't carry forward that information from the filter without additional type information, which would be more error-prone and actually make it less safe. So, this case should never be hit, but it's necessary to tell TypeScript that this is still the case and that we have access to GitHub origin information.
| return null; | ||
| } | ||
|
|
||
| return { |
There was a problem hiding this comment.
If there is no new commit, but the CodeQL tools have been upgraded since the DB was created should we then also trigger an upgrade?
There was a problem hiding this comment.
Yes, I think that is something we should consider. I've now changed the check to also consider the database's created_at date. This can result in more prompts (e.g. if there is a scheduled workflow run to scan main every day and there are no commits), but I think that's fine for now; we can always reconsider.
This adds a prompt for updating GitHub databases for the current repository. If the user clicks "Update", it will prompt for which languages to update the database for. Once selected, it will download and store the new databases, and then automatically delete the old ones. It will keep the selected database to the same language and repository.
Checklist
ready-for-doc-reviewlabel there.