diff --git a/.github/workflows/notes-mirror.yml b/.github/workflows/notes-mirror.yml new file mode 100644 index 000000000..c107e9251 --- /dev/null +++ b/.github/workflows/notes-mirror.yml @@ -0,0 +1,35 @@ +# A release's notes are copied here once, when release.yml's mirror-release +# job publishes it. When DeepSeek turned the notes away, magpie-releases' +# notes.yml writes them again later (each hour, at :23), and this copies +# them to this repo's release of the same tag: one here still without the +# marker gets magpie-releases' notes once those have it. +# The app reads magpie-releases (usemagpie.ai's /api/notes), so this is +# the GitHub page alone. +name: notes-mirror + +on: + schedule: + - cron: '53 * * * *' + workflow_dispatch: + +permissions: + contents: write + +jobs: + mirror: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Copy notes written again + run: | + set -uo pipefail + tags=$(gh release list -R "$GITHUB_REPOSITORY" -L 100 --exclude-drafts --json tagName -q '.[].tagName') || exit 1 + for t in $tags; do + here=$(gh release view "$t" -R "$GITHUB_REPOSITORY" --json body -q .body) || continue + if printf '%s' "$here" | grep -qF ''; then continue; fi + there=$(gh release view "$t" -R yetone/magpie-releases --json body -q .body) || continue + if ! printf '%s' "$there" | grep -qF ''; then continue; fi + { printf '%s' "$there"; printf '\n\n---\nThe same release, and the feed magpie updates from: https://github.com/yetone/magpie-releases/releases/tag/%s\n' "$t"; } > notes.md + gh release edit "$t" -R "$GITHUB_REPOSITORY" --notes-file notes.md >/dev/null && echo "$t: notes copied" + done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea35fb2f5..1c6c9f22e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -105,7 +105,9 @@ jobs: # balance did so for v0.1.1233 to v0.1.1242, and Chinese apps showed # English for a day until a user said so (#2122). Its warning is in a # log nobody reads, so a release without them is said here, on one - # open issue, where the notes get added by hand. + # open issue. magpie-releases' notes.yml writes them again each hour + # once DeepSeek answers (it didn't for v0.1.2634 to 2646, a spent + # balance again), and notes-mirror.yml copies them here. - name: Say when the notes have no Chinese env: GH_REPO: ${{ github.repository }} @@ -116,7 +118,7 @@ jobs: exit 0 fi title="Release notes without Chinese" - msg="$REF went out with English notes alone: magpie-releases' release run got no Chinese from DeepSeek. Its reason is the \`DeepSeek wrote no Chinese notes\` warning in that run's Generate changelog step (https://github.com/yetone/magpie-releases/actions). Until the Chinese is added below a \`\` marker, in the release on yetone/magpie-releases and here, apps set to Chinese show its notes in English (#2122)." + msg="$REF went out with English notes alone: magpie-releases' release run got no Chinese from DeepSeek. Its reason is the \`DeepSeek wrote no Chinese notes\` warning in that run's Generate changelog step (https://github.com/yetone/magpie-releases/actions); \`insufficient_balance_error\` means the DEEPSEEK_API_KEY account needs a top-up. Until then apps set to Chinese show its commit subjects (#2122). magpie-releases' notes.yml writes the notes again each hour once DeepSeek answers, and notes-mirror.yml copies them here; notes written by hand below a \`\` marker are kept." n=$(gh issue list --state open --search "\"$title\" in:title" --json number,title -q ".[] | select(.title == \"$title\") | .number" | head -1) || n="" if [ -n "$n" ]; then gh issue comment "$n" --body "$msg" || echo "::warning::could not comment on #$n: $msg"