[q] fix: show effective tokens (ET) in discussion footer#24320
Merged
Conversation
create_discussion.cjs was building the footer with a hardcoded string instead of using generateFooterWithMessages(), which reads GH_AW_EFFECTIVE_TOKENS and appends the ET value (e.g. '● 3.6M'). Switch to the same pattern used by create_issue.cjs and add_comment.cjs: - Use generateFooterWithMessages() for the footer body - Use addExpirationToFooter() to inject the expiration line - Use generateHistoryUrl() (raw URL) instead of generateHistoryLink() - Extract triggering context and workflow source from env/context This ensures discussions show ET in their footer alongside the workflow run link and history link. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Root Cause
create_discussion.cjswas building the footer with a hardcoded string:This bypassed
generateFooterWithMessages(), which is the shared helper that readsGH_AW_EFFECTIVE_TOKENSfrom the environment and appends the ET value (e.g.● 3.6M) to the footer.Both
create_issue.cjsandadd_comment.cjsalready usegenerateFooterWithMessages()correctly, so this was an inconsistency increate_discussion.cjs.Investigation
Audited run #23947396770 (Documentation Noob Tester) which produced discussion #24309. The run consumed 3.56M effective tokens but the footer showed no ET:
Fix
Switch
create_discussion.cjsto use the same pattern ascreate_issue.cjs:generateFooterWithMessages()for the footer body (reads ET fromGH_AW_EFFECTIVE_TOKENS)addExpirationToFooter()to inject the expiration linegenerateHistoryUrl()(raw URL) instead ofgenerateHistoryLink()(markdown link)triggeringIssueNumber,triggeringPRNumber,triggeringDiscussionNumber) and workflow source from env/contextAfter the fix, discussion footers will show:
Validation
make fmt-cjs✅make lint-cjs✅create_discussion*.test.cjstests pass ✅ (44 + 10 + 5 + 9 tests)