Skip to content

Conversation

@graycreate
Copy link
Member

Summary

Fix the issue where releases were tagging @gray instead of @graycreate in the changelog.

Problem

The release workflow was falling back to git author name (Gray Zhang) when GitHub API calls failed, resulting in incorrect @gray mentions instead of @graycreate.

Solution

  1. Added GH_TOKEN environment variable to ensure gh api calls authenticate properly
  2. Enhanced the username resolution logic:
    • First tries author.login from GitHub API
    • Then tries committer.login as fallback
    • Finally uses a mapping table for known authors (Gray Zhang → @graycreate)
  3. This ensures consistent and correct GitHub username tagging in release changelogs

Testing

  • Tested gh api calls return correct username: ✅
  • Added fallback mapping for Gray Zhang → @graycreate: ✅

🤖 Generated with Claude Code

- Add GH_TOKEN environment variable for gh api calls
- Try both author.login and committer.login from GitHub API
- Add fallback mapping for known git authors (Gray Zhang -> @graycreate)
- This ensures releases show @graycreate instead of @gray
Copilot AI review requested due to automatic review settings September 17, 2025 11:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes GitHub username tagging in release changelogs by ensuring the workflow correctly resolves usernames through the GitHub API and provides fallback mappings for known authors.

  • Added GH_TOKEN environment variable to authenticate GitHub API calls
  • Enhanced username resolution with multiple fallback strategies including API-based lookup and hardcoded mappings
  • Replaced simple git author name fallback with a more robust system that maps "Gray Zhang" to "@graycreate"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# Fallback to git author name if API fails
echo "@$(git show -s --format='%an' $commit_sha)"
# Fallback: try to get committer login if author login is not available
local committer=$(gh api "repos/${{ github.repository }}/commits/${commit_sha}" --jq '.committer.login // empty' 2>/dev/null || echo "")
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub API call for committer.login duplicates the repository and commit SHA parameters from the author lookup above. Consider extracting the API call logic into a reusable function to avoid repetition and improve maintainability.

Copilot uses AI. Check for mistakes.
# Last resort: use hardcoded mapping for known authors
local git_author=$(git show -s --format='%an' $commit_sha)
case "$git_author" in
"Gray Zhang" | "gray" | "Gray")
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The hardcoded mapping includes multiple variations of the same author name. Consider whether all these variations ('gray', 'Gray') are actually needed in practice, as they may create confusion and maintenance overhead.

Suggested change
"Gray Zhang" | "gray" | "Gray")
# Only the canonical author name is mapped; add more if needed in the future
"Gray Zhang")

Copilot uses AI. Check for mistakes.
@graycreate graycreate merged commit c60f34c into main Sep 17, 2025
5 checks passed
@graycreate graycreate deleted the bugfix/fix-release-contributor-tagging branch September 17, 2025 11:57
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