Skip to content

Instantly share code, notes, and snippets.

@MelbourneDeveloper
Created September 27, 2024 09:56
Show Gist options
  • Select an option

  • Save MelbourneDeveloper/eb5b1c570a97810f7f3bdc7b4c70cf6b to your computer and use it in GitHub Desktop.

Select an option

Save MelbourneDeveloper/eb5b1c570a97810f7f3bdc7b4c70cf6b to your computer and use it in GitHub Desktop.

Revisions

  1. MelbourneDeveloper created this gist Sep 27, 2024.
    14 changes: 14 additions & 0 deletions get_contributors.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash

    contributor_data=$(curl -s -H "Accept: application/vnd.github.v3+json" \
    "https://api.github.com/repos/Nimblesite/nimble_charts/commits?since=$(date -v-3m +%Y-%m-%dT%H:%M:%SZ)&per_page=100" | \
    jq -r '.[] | select(.author != null) | "\(.author.login) \(.author.avatar_url)"' |
    sort | uniq -c | sort -rn |
    awk '{printf "%s %s %s\n", $2, $3, $1}')

    echo "| Avatar | Username | Commits |"
    echo "|--------|----------|---------|"

    echo "$contributor_data" | while read -r username avatar_url commits; do
    echo "| <img src=\"$avatar_url\" width=\"50\" height=\"50\" alt=\"$username\"> | [$username](https://github.com/$username) | $commits |"
    done