Raid times: published from a normal PC, not GitHub Actions
Chronicle's site is behind Cloudflare, which challenges requests from GitHub's servers, so the scheduled sync can't run there. The workflow now only keeps DopingControl updated (daily). ChronicleData.lua is refreshed with tools\Publish-RaidTimes.cmd (maintainer): it runs the sync with -CI (guild times only), then commits and pushes the file when times changed. Wording in the README, tooltips and comments no longer claims GitHub refreshes the times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,62 +1,41 @@
|
||||
# Fetches every guild's raid times from Chronicle's public API and ships them
|
||||
# in the addon (ChronicleData.lua), so players don't have to run anything on
|
||||
# their PC. Also keeps the built-in DopingControl (MIT) up to date.
|
||||
# No player characters are read or written: guild times only.
|
||||
name: Chronicle raid times
|
||||
# Keeps the built-in DopingControl (MIT) up to date from its author's GitHub.
|
||||
#
|
||||
# Chronicle's raid times can't be fetched from here: chronicleclassic.com sits
|
||||
# behind Cloudflare, which challenges requests from GitHub's servers. They're
|
||||
# fetched on a normal PC instead (tools\WhoDidIt-Sync.ps1) and ChronicleData.lua
|
||||
# is updated from there.
|
||||
name: Update DopingControl
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "17 */4 * * *" # every 4 hours
|
||||
- cron: "17 5 * * *" # once a day
|
||||
workflow_dispatch: # "Run workflow" button on GitHub
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: chronicle-sync
|
||||
group: embed-update
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
update:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 300
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# what earlier runs already read from Chronicle, so only new uploads are fetched
|
||||
- name: Restore the Chronicle cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: .ci/WhoDidIt_ChronicleCache.json
|
||||
key: chronicle-cache-${{ github.run_id }}
|
||||
restore-keys: chronicle-cache-
|
||||
|
||||
- name: Sync from Chronicle
|
||||
shell: powershell
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force .ci | Out-Null
|
||||
& .\tools\WhoDidIt-Sync.ps1 -CI -DataDir "$PWD\.ci" -LuaOut "$PWD\ChronicleData.lua" -DetailsPerSync 600
|
||||
|
||||
- name: Save the Chronicle cache
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: .ci/WhoDidIt_ChronicleCache.json
|
||||
key: chronicle-cache-${{ github.run_id }}
|
||||
|
||||
- name: Update DopingControl
|
||||
shell: powershell
|
||||
run: |
|
||||
& .\tools\EmbedUpdate.ps1 -Only Doping
|
||||
|
||||
# commit only when something besides the "synced at" stamp changed
|
||||
- name: Commit
|
||||
shell: bash
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A ChronicleData.lua DopingControl WhoDidIt.toc
|
||||
real=$(git diff --cached -U0 | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)' | grep -v 'WDICHRON|' | wc -l)
|
||||
if [ "$real" -eq 0 ]; then echo "Nothing new"; exit 0; fi
|
||||
git commit -m "Chronicle raid times $(date -u '+%Y-%m-%d %H:%M') UTC"
|
||||
git add -A DopingControl WhoDidIt.toc
|
||||
if git diff --cached --quiet; then echo "Nothing new"; exit 0; fi
|
||||
git commit -m "DopingControl update"
|
||||
git push
|
||||
|
||||
@@ -95,7 +95,7 @@ end
|
||||
|
||||
-- (re)read the sync file; true if it changed
|
||||
function B:LoadChronicle()
|
||||
-- the times shipped in the addon (ChronicleData.lua, refreshed by a GitHub
|
||||
-- the times shipped in the addon (ChronicleData.lua, updated in the repository
|
||||
-- Action), or the optional helper's file when it's newer
|
||||
local s
|
||||
if ReadCustomFile then
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
-- Every guild's raid times from Chronicle (chronicleclassic.com), fetched by
|
||||
-- WhoDidIt's GitHub Action (tools\WhoDidIt-Sync.ps1 -CI). Generated - do not edit.
|
||||
-- tools\WhoDidIt-Sync.ps1 -CI. Generated - do not edit.
|
||||
WDI_CHRON_DATA = [[
|
||||
WDICHRON|2|1791298068|OctoWoW|90|ok
|
||||
C|N'Zoth|Lower Tower of Karazhan|Repentance|Mixed|2417.9|1790969965|10|1ML2vlB5C1gVvP5g
|
||||
|
||||
@@ -235,11 +235,11 @@ realm's fastest guild gets under our time.
|
||||
|
||||
### Every guild's times from Chronicle
|
||||
|
||||
WoW addons can't go online, so WhoDidIt's GitHub repository does it for everyone: every 4 hours a scheduled GitHub
|
||||
Action ([`.github/workflows/chronicle-sync.yml`](.github/workflows/chronicle-sync.yml)) uses Chronicle's public
|
||||
[External API](https://legacy.chronicleclassic.com/developers/api) and saves the times in the addon as
|
||||
`ChronicleData.lua`. **Updating WhoDidIt gets you the newest times; nothing runs on your PC.** It holds guild times
|
||||
only: no player characters, and nothing about you is ever sent anywhere. It pulls:
|
||||
WoW addons can't go online, so the times come **with the addon**, in `ChronicleData.lua`: they're fetched from
|
||||
Chronicle's public [External API](https://legacy.chronicleclassic.com/developers/api) and updated in the repository
|
||||
regularly. **Updating WhoDidIt gets you the newest times; nothing runs on your PC.** The file holds guild times only:
|
||||
no player characters, and nothing about you is ever sent anywhere. (GitHub can't fetch them itself: Chronicle's site
|
||||
is behind Cloudflare, which blocks requests from GitHub's servers.) It pulls:
|
||||
|
||||
- **full clears** from Chronicle's speedrun leaderboards
|
||||
- **boss kill times** from every uploaded raid log on your server (OctoWoW: C'Thun, N'Zoth, Y'Shaarj)
|
||||
@@ -265,6 +265,7 @@ tools\WhoDidIt-Sync.cmd -NoRollForUpdate leave RollFor alone
|
||||
tools\WhoDidIt-Sync.cmd -NoPackUpdate leave the mob packs alone
|
||||
tools\WhoDidIt-Sync.cmd -DetailsPerSync 600 read more raids in full per sync (default 150)
|
||||
tools\WhoDidIt-Sync.cmd -IncludeMyCharacters also find your own characters' personal bests (off by default)
|
||||
tools\Publish-RaidTimes.cmd (maintainer) refresh ChronicleData.lua and push it to GitHub
|
||||
```
|
||||
|
||||
- **First sync:** reads every raid log from the last 90 days once, about 45 minutes for OctoWoW. Data appears in game as it goes.
|
||||
|
||||
@@ -1303,7 +1303,7 @@ local function syncNow()
|
||||
local B = W.Board
|
||||
local st = B:SyncStatus()
|
||||
if not (st and st.alive) then
|
||||
W.Print("Raid times come with the addon and are refreshed on GitHub every few hours - update WhoDidIt to get the newest. "
|
||||
W.Print("Raid times come with the addon - update WhoDidIt to get the newest. "
|
||||
.. "|cff888888(Optional: the helper tools\\WhoDidIt-Sync.cmd keeps them fresher on your PC, and makes Sync now work.)|r")
|
||||
return
|
||||
end
|
||||
@@ -1319,7 +1319,7 @@ syncBtn:SetScript("OnClick", syncNow)
|
||||
syncBar:SetScript("OnClick", syncNow)
|
||||
local function syncTip()
|
||||
local l = { "Every guild's kill and clear times come from Chronicle (chronicleclassic.com).",
|
||||
"They come with the addon: GitHub fetches them every few hours, so updating WhoDidIt",
|
||||
"They come with the addon and are updated regularly, so updating WhoDidIt"
|
||||
"gets you the newest. Nothing runs on your PC and nothing about you is sent anywhere.",
|
||||
" ",
|
||||
"|cff888888Optional: the helper tools\\WhoDidIt-Sync.cmd fetches them on your PC every 10 minutes|r",
|
||||
@@ -1343,7 +1343,7 @@ function UI:UpdateSync()
|
||||
syncBar.top:SetText("|cffff7777Needs Nampower|r")
|
||||
syncBar.bot:SetText("to read the Chronicle times")
|
||||
elseif (not st or not st.alive) and c and B.chronBundled then
|
||||
-- the times that came with the addon (GitHub refreshes them every few hours)
|
||||
-- the times that came with the addon (ChronicleData.lua)
|
||||
bar(1, 0.15, 0.55, 0.25)
|
||||
syncBar.top:SetText("|cff33ff33Raid times from " .. ago(c.synced or 0) .. "|r")
|
||||
syncBar.bot:SetText("came with the addon - update it for newer")
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ Tracker.lua
|
||||
Analyzer.lua
|
||||
Career.lua
|
||||
Shoutout.lua
|
||||
# every guild's raid times, refreshed by a GitHub Action (see .github/workflows)
|
||||
# every guild's raid times from Chronicle (tools\WhoDidIt-Sync.ps1 -CI writes it)
|
||||
ChronicleData.lua
|
||||
Board.lua
|
||||
Logs.lua
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
title WhoDidIt - publish raid times (maintainer)
|
||||
rem Refreshes ChronicleData.lua from Chronicle and pushes it to GitHub.
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Publish-RaidTimes.ps1" %*
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
Publish-RaidTimes - for the WhoDidIt maintainer: refreshes ChronicleData.lua
|
||||
(every guild's raid times, shipped inside the addon) and pushes it to
|
||||
GitHub, so players get new times just by updating WhoDidIt.
|
||||
|
||||
It runs WhoDidIt-Sync.ps1 -CI (guild times only - no characters are read
|
||||
or written), keeping its cache in .ci\ in the repository (git-ignored),
|
||||
then commits and pushes ChronicleData.lua if any time changed.
|
||||
|
||||
Run it now and then, or from a Windows scheduled task. Needs git, with
|
||||
push access to the repository.
|
||||
#>
|
||||
$ErrorActionPreference = "Stop"
|
||||
$repo = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
||||
$ci = Join-Path $repo ".ci"
|
||||
New-Item -ItemType Directory -Force $ci | Out-Null
|
||||
$lua = Join-Path $repo "ChronicleData.lua"
|
||||
|
||||
& (Join-Path $PSScriptRoot "WhoDidIt-Sync.ps1") -CI -DataDir $ci -LuaOut $lua -DetailsPerSync 600
|
||||
|
||||
Push-Location $repo
|
||||
try {
|
||||
git add ChronicleData.lua
|
||||
# only the "synced at" stamp changed: nothing worth publishing
|
||||
$real = @(git diff --cached -U0 -- ChronicleData.lua | Where-Object { $_ -match '^[+-]' -and $_ -notmatch '^(\+\+\+|---)' -and $_ -notmatch 'WDICHRON\|' }).Count
|
||||
if ($real -eq 0) {
|
||||
git reset -q -- ChronicleData.lua
|
||||
Write-Host "No new raid times - nothing to publish."
|
||||
return
|
||||
}
|
||||
git commit -q -m ("Chronicle raid times " + (Get-Date).ToUniversalTime().ToString("yyyy-MM-dd HH:mm") + " UTC") -- ChronicleData.lua
|
||||
git push -q
|
||||
Write-Host "Published new raid times ($real changed lines)."
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
@@ -13,9 +13,10 @@
|
||||
so your personal bests show up too. It's off unless you ask for it.
|
||||
Nothing is ever uploaded: the helper only downloads public Chronicle data.
|
||||
|
||||
The same data is also fetched for everyone by a scheduled GitHub Action
|
||||
(-CI) and shipped in the addon as ChronicleData.lua, so running this is
|
||||
optional: it just keeps the times fresher and adds Sync now in game.
|
||||
The same data also ships in the addon as ChronicleData.lua (written with
|
||||
-CI and committed to the repository), so running this is optional: it
|
||||
just keeps the times fresher and adds Sync now in game. (GitHub Actions
|
||||
can't fetch it: Chronicle's Cloudflare blocks GitHub's servers.)
|
||||
|
||||
It also installs and updates what's built into WhoDidIt, each from its
|
||||
official source, checking every hour:
|
||||
@@ -40,7 +41,7 @@
|
||||
WhoDidIt-Sync.ps1 -NoPackUpdate leave the mob packs alone
|
||||
WhoDidIt-Sync.ps1 -DetailsPerSync 600 read more raids in full per sync (default 150)
|
||||
WhoDidIt-Sync.ps1 -IncludeMyCharacters also find your own characters' personal bests
|
||||
WhoDidIt-Sync.ps1 -CI -DataDir <dir> -LuaOut <file> one sync for the GitHub Action:
|
||||
WhoDidIt-Sync.ps1 -CI -DataDir <dir> -LuaOut <file> one sync for the repository:
|
||||
no updates, no characters, writes ChronicleData.lua
|
||||
|
||||
The API allows 60 requests a minute; this stays at about one a second
|
||||
@@ -330,12 +331,12 @@ function Write-Output-File($clears, $myClears, $cache, $status) {
|
||||
$lines.Add(("L|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}" -f $slug, (Clean $l.realm), (Clean $l.instance), (Clean $l.guild), $l.faction,
|
||||
$l.ended, $l.players, ($ks -join ";")))
|
||||
}
|
||||
# the GitHub Action ships it inside the addon too, as a Lua string
|
||||
# -LuaOut: the copy that ships inside the addon, as a Lua string
|
||||
# (Lua 5.0 long strings can't hold [[ or ]], so those are broken up)
|
||||
if ($LuaOut) {
|
||||
$body = ($lines -join "`n") -replace '\[\[', '[ [' -replace '\]\]', '] ]'
|
||||
$lua = "-- Every guild's raid times from Chronicle (chronicleclassic.com), fetched by`n" +
|
||||
"-- WhoDidIt's GitHub Action (tools\WhoDidIt-Sync.ps1 -CI). Generated - do not edit.`n" +
|
||||
"-- tools\WhoDidIt-Sync.ps1 -CI. Generated - do not edit.`n" +
|
||||
"WDI_CHRON_DATA = [[`n" + $body + "`n]]`n"
|
||||
[IO.File]::WriteAllText($LuaOut, $lua, (New-Object Text.UTF8Encoding($false)))
|
||||
}
|
||||
@@ -521,7 +522,7 @@ if ($UpdatesOnly) {
|
||||
return
|
||||
}
|
||||
|
||||
# the GitHub Action: one sync, nothing else
|
||||
# -CI: one sync for the repository's ChronicleData.lua, nothing else
|
||||
if ($CI) {
|
||||
Log "WhoDidIt-Sync (CI) for $Server -> $LuaOut"
|
||||
Sync
|
||||
|
||||
Reference in New Issue
Block a user