This repository was archived by the owner on Oct 27, 2025. It is now read-only.
Discord Sync 🎮 #4053
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: Discord Sync 🎮 | |
| on: | |
| schedule: | |
| - cron: '* 1 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update_discord_stats: | |
| strategy: | |
| matrix: | |
| stat: ['stars', 'issues', 'pull_requests'] | |
| include: | |
| - stat: 'stars' | |
| NAME: "⭐ Stars" | |
| CHANNEL: '954517855498547282' | |
| JQ: '.data.repository.stargazerCount' | |
| REQUEST: | | |
| query release($owner:String!,$repo:String!) { | |
| repository(owner:$owner,name:$repo) { | |
| stargazerCount | |
| } | |
| } | |
| - stat: 'issues' | |
| NAME: "🔧 Issues" | |
| CHANNEL: '954497399903117323' | |
| JQ: '.data.repository.issues.totalCount' | |
| REQUEST: | | |
| query release($owner:String!,$repo:String!) { | |
| repository(owner:$owner,name:$repo) { | |
| issues(states: OPEN){ | |
| totalCount | |
| } | |
| } | |
| } | |
| - stat: 'pull_requests' | |
| NAME: "➕ Pull Requests" | |
| CHANNEL: '954497747527028796' | |
| JQ: '.data.repository.pullRequests.totalCount' | |
| REQUEST: | | |
| query release($owner:String!,$repo:String!) { | |
| repository(owner:$owner,name:$repo) { | |
| pullRequests(states: OPEN){ | |
| totalCount | |
| } | |
| } | |
| } | |
| runs-on: ubuntu-latest | |
| name: "${{ matrix.NAME }}" | |
| steps: | |
| - name: Extract repository name | |
| run: | | |
| echo "repository_name=$(echo '${{ github.repository }}' | awk -F / '{print $2}')" >> $GITHUB_ENV | |
| echo "repository_owner=$(echo '${{ github.repository }}' | awk -F / '{print $1}')" >> $GITHUB_ENV | |
| - name: Retrieve data from GitHub API | |
| run: | | |
| echo "metric=$(gh api graphql -F owner=${{ env.repository_owner }} -F repo=${{ env.repository_name }} -f query='${{ matrix.REQUEST }}' --jq '${{ matrix.JQ }}')" >> $GITHUB_ENV | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update Discord channel | |
| run: | | |
| curl --request PATCH \ | |
| --url https://discord.com/api/v9/channels/${{ matrix.CHANNEL }} \ | |
| --header 'Authorization: Bot ${{ secrets.DISCORD_BOT_TOKEN }}' \ | |
| --header 'Content-Type: application/json' \ | |
| --data '{"name": "${{ matrix.NAME }}: ${{ env.metric }}"}' |