Skip to content

Commit

Permalink
compat_db: use higher compression level to zip
Browse files Browse the repository at this point in the history
  • Loading branch information
nishinji committed Feb 18, 2025
1 parent 95981a8 commit 99676e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/update_compat_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ jobs:
$headers = @{
Authorization = "Token ${{ secrets.GITHUB_TOKEN }}"
}
# 1. Get the latest issue information
$compat_link = "https://api.github.com/repos/Vita3K/compatibility"
$issues_link = $compat_link + "/issues"
$app_updated = (Invoke-RestMethod -Uri $issues_link"?state=all&sort=updated" -Headers $headers)[0]
$db_updated_at = [DateTime]::Parse($app_updated.updated_at).ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ssZ", [System.Globalization.CultureInfo]::InvariantCulture)
$db_updated_at_old = [DateTime]::Parse($app_updated.updated_at).ToUniversalTime().ToString("MM-dd-yyyy HH:mm:ss", [System.Globalization.CultureInfo]::InvariantCulture) # Do not delete this line for keep compatibility
$open_issues_count = (Invoke-RestMethod -Uri "$compat_link" -Headers $headers).open_issues_count
$page_count = @()
# 2. Get count of retrieval open_issues_count
for ($i = 0; $i -lt $open_issues_count; $i += 100) {
$page = [Math]::Floor($i / 100) + 1
$per_page = [Math]::Min($open_issues_count - $i, 100)
$page_count += New-Object PSObject -Property @{First=$page; Second=$per_page}
}
# 3. Initialize XML document
$xml = New-Object System.Xml.XmlDocument
$xml.AppendChild($xml.CreateXmlDeclaration("1.0", "UTF-8", $null)) | Out-Null
$xml.AppendChild($xml.CreateComment("This file is automatically generated by a GitHub action. Do not edit it manually.")) | Out-Null
Expand All @@ -40,6 +46,8 @@ jobs:
$root.SetAttribute("version", "1")
$xml.AppendChild($root) | Out-Null
$issue_count = 0
# 4. Retrieve issue information
foreach ($page in $page_count) {
$current_page = $page.First
$per_page = $page.Second
Expand Down Expand Up @@ -72,6 +80,8 @@ jobs:
$issue_count++
}
}
# 5. Construct XML nodes
$root.SetAttribute("issue_count", $issue_count)
$xml.Save("app_compat_db.xml")
"$issue_count issues have been retrieved from the compatibility database"
Expand All @@ -85,7 +95,7 @@ jobs:
- name: Zip compatibility database
run: |
Compress-Archive -Path app_compat_db.xml -DestinationPath app_compat_db.xml.zip
7z a -mx=9 app_compat_db.xml.zip app_compat_db.xml
# 7z a -mx=9 app_compat_db.xml.7z app_compat_db.xml
- name: Prepare files for release
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# compatibility

#### [Commercial game compatibility database for Vita3K.](https://github.com/Vita3K/compatibility/issues)

---
Expand Down

0 comments on commit 99676e0

Please sign in to comment.