Top Issues by Votes #1019
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
| name: Top Issues by Votes | |
| on: | |
| schedule: | |
| - cron: "0 */2 * * *" # Run every 2 hours | |
| workflow_dispatch: # Allow manual triggering | |
| permissions: | |
| issues: write | |
| contents: read | |
| jobs: | |
| update-top-issues: | |
| # Only run if the repository is in the Teneo-Protocol organization | |
| if: github.repository_owner == 'TeneoProtocolAI' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Update top issues list for teneo-agent-sdk | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Set this to the issue number where you want to track top issues | |
| # Leave empty to skip updating (will only log) | |
| ISSUE_NUMBER: "1" | |
| run: | | |
| #!/bin/bash | |
| set -e | |
| echo "Fetching all open issues for teneo-agent-sdk..." | |
| # Extract owner and repo from GitHub context | |
| REPO_OWNER="${{ github.repository_owner }}" | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| echo "Repository: $REPO_OWNER/$REPO_NAME" | |
| # Fetch all open issues with reaction data | |
| issues=$(gh api graphql -f query=' | |
| query($owner: String!, $repo: String!) { | |
| repository(owner: $owner, name: $repo) { | |
| issues(first: 100, states: OPEN, orderBy: {field: CREATED_AT, direction: DESC}) { | |
| nodes { | |
| number | |
| title | |
| url | |
| reactions(content: THUMBS_UP) { | |
| totalCount | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ' -f owner="$REPO_OWNER" -f repo="$REPO_NAME") | |
| # Parse and sort issues by thumbs up count | |
| sorted_issues=$(echo "$issues" | jq -r --arg ISSUE_NUMBER "$ISSUE_NUMBER" ' | |
| .data.repository.issues.nodes | |
| | map(select(.number != ($ISSUE_NUMBER | tonumber))) | |
| | sort_by(-.reactions.totalCount) | |
| | to_entries | |
| | map("\(.key + 1). [\(.value.title)](\(.value.url)) - \(.value.reactions.totalCount) 👍") | |
| | join("\n") | |
| ') | |
| # Create issue body | |
| current_time=$(date -u +"%Y-%m-%d %H:%M:%S UTC") | |
| { | |
| echo "# 👍 Top Issues by Community Votes" | |
| echo "" | |
| echo "This list shows the most requested features and reported bugs for **teneo-agent-sdk**," | |
| echo "automatically updated every 6 hours based on 👍 reactions." | |
| echo "" | |
| echo "**Last updated:** $current_time" | |
| echo "" | |
| echo "## Top Issues" | |
| echo "" | |
| if [ -n "$sorted_issues" ]; then | |
| echo "$sorted_issues" | |
| else | |
| echo "No issues found or all issues have 0 votes." | |
| fi | |
| echo "" | |
| echo "---" | |
| echo "💡 *Vote on issues by adding a 👍 reaction to help prioritize development*" | |
| echo "" | |
| echo "🤖 *Automatically updated by [GitHub Actions](.github/workflows/top-issue.yml)*" | |
| } > /tmp/issue_body.md | |
| # Update the tracking issue if ISSUE_NUMBER is set | |
| if [ -n "$ISSUE_NUMBER" ]; then | |
| echo "Updating tracking issue #$ISSUE_NUMBER..." | |
| gh issue edit "$ISSUE_NUMBER" \ | |
| --repo "$REPO_OWNER/$REPO_NAME" \ | |
| --body-file /tmp/issue_body.md | |
| echo "✅ Successfully updated top issues list!" | |
| else | |
| echo "📋 Top issues list (ISSUE_NUMBER not set, skipping update):" | |
| cat /tmp/issue_body.md | |
| echo "" | |
| echo "💡 To enable automatic tracking, create an issue and set ISSUE_NUMBER in the workflow." | |
| fi |