{{ message }}
Repository navigation
Conversation
reward-* tags pointed at PR merge commits and statistic-* tags at the default branch HEAD, so they became the nearest tag in git describe for later commits. statistic-* releases were also created without --latest=false, so the GitHub API marked them as the Latest release. - Point new reward-* / statistic-* tags at a parentless empty-tree commit (the merge commit SHA is kept in its message) so no branch reaches them; tag contents and dates are read as before - Create statistic-* releases with --latest=false - Drop the describe-based "new commits since last statistic" check, which cannot see detached tags; count-reward.ts already exits when there is no reward data for the previous month Same fix as iflytek/astron-agent#1695. Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
Rewards are free text since f50553f, and the statistic counted each distinct string, so "500 CNY" and "300 CNY" for the same payee showed up as two separate one-off entries instead of a total. Parse rewards shaped like an amount with a unit on either side ("500 CNY", "1,000 cny", "USD 50", "¥200") and sum them per unit under reward; anything else (badges, gifts, bare numbers without a unit) keeps being counted under items. Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This applies the reward-bot fix from iflytek/astron-agent#1695 (issue iflytek/astron-agent#1694), which uses the same scripts:
share-reward.ts/count-reward.ts: point newreward-*/statistic-*tags at a parentless empty-tree commit, created by.github/scripts/git.ts. The merge commit SHA stays in that commit's message. Previously these tags pointed at merge commits ormainHEAD and became the nearest tag ingit describefor later commits; in astron-agent, most commits between two releases described asreward-1575-N-g….count-reward.ts: createstatistic-*releases with--latest=false, so a monthly reward summary never becomes the repository's "Latest" release.statistic-member-reward.yml: remove thegit describe --match "statistic-*"pre-check, which cannot see detached tags.count-reward.tsalready exits when the previous month has no reward data.count-reward.ts: sum amount rewards per unit. Rewards have been free text since f50553f, and the statistic counted each distinct string, so500 CNYand300 CNYfor the same payee showed up as two separate entries with count 1 instead of a total. Rewards shaped like an amount with a unit on either side (500 CNY,1,000 cny,USD 50,¥200) are now summed per unit underreward. Everything else (badges, gifts, a bare number without a unit) is still counted, underitems. When several people share one issue, each still gets the full reward text, as before.This repo has no tags or releases yet, so nothing needs migrating. The change keeps the scripts in sync with astron-agent and skillhub, and prevents the problem before the first payout.
Testing
I ran this end-to-end in a sandbox repo with a local bare remote, Deno 2.9 and a fake
ghonPATH:share-reward.tstagging and push code createdreward-42on a commit with no parents and the empty tree.count-reward.tsfound the tag by creator date, pushedstatistic-2026-10on a second detached commit, and calledgh release create … --latest=false.git describe --tags HEADstill returned thev1.0.0tag on the branch.@bob, the result wasreward: {CNY: 1800.5, USD: 50}, items: {Official Badge: 2}(from 500 CNY + 300 cny + 1,000.5 CNY, USD 50, 2 × Official Badge). For@carol, it wasreward: {Exclusive Badge: 2, ¥: 200}, items: {"300": 1}. The tag from this month was correctly excluded.deno checkpasses forcount-reward.tsandshare-reward.ts.