ci(reward): keep reward tags off Latest and sum amount rewards per unit by FenjuFu · Pull Request #90 · iflytek/astronclaw-tutorial · GitHub
Skip to content

ci(reward): keep reward tags off Latest and sum amount rewards per unit - #90

Open
FenjuFu wants to merge 2 commits into
mainfrom
ci/reward-tags-detached
Open

FenjuFu wants to merge 2 commits into
mainfrom
ci/reward-tags-detached

Conversation

@FenjuFu

@FenjuFu FenjuFu commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

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 new reward-* / 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 or main HEAD and became the nearest tag in git describe for later commits; in astron-agent, most commits between two releases described as reward-1575-N-g….
  • count-reward.ts: create statistic-* releases with --latest=false, so a monthly reward summary never becomes the repository's "Latest" release.
  • statistic-member-reward.yml: remove the git describe --match "statistic-*" pre-check, which cannot see detached tags. count-reward.ts already 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, so 500 CNY and 300 CNY for 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 under reward. Everything else (badges, gifts, a bare number without a unit) is still counted, under items. 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 gh on PATH:

  • This branch's share-reward.ts tagging and push code created reward-42 on a commit with no parents and the empty tree.
  • This branch's count-reward.ts found the tag by creator date, pushed statistic-2026-10 on a second detached commit, and called gh release create … --latest=false.
  • git describe --tags HEAD still returned the v1.0.0 tag on the branch.
  • No git identity was left in the local config.
  • I ran the statistic again with 9 reward tags dated last month and 1 dated this month. For @bob, the result was reward: {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 was reward: {Exclusive Badge: 2, ¥: 200}, items: {"300": 1}. The tag from this month was correctly excluded.
  • deno check passes for count-reward.ts and share-reward.ts.

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>
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

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>
@FenjuFu FenjuFu changed the title ci(reward): keep reward tags off Latest and out of git describe ci(reward): keep reward tags off Latest and sum amount rewards per unit Oct 3, 2026

This branch was successfully deployed

1 active deployment
Preview — c4bcf51b Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant