diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abc18ce..702bc46 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,12 +40,12 @@ jobs: for member in "${members[@]}"; do echo "Fetching commit history for $member..." - # member_commits=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GDSC_GH_TOKEN }}" "https://api.github.com/users/${member}/events") - commits_data=$(echo "$member_commits" | jq -r 'map(select(.type == "PushEvent")) | .[] | {commitId: .payload.commits[0].sha, userName: .payload.commits[0].author.name, commitTime: .created_at, commitMessage: .payload.commits[0].message, commitLink: .payload.commits[0].url }') + member_commits=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GDSC_GH_TOKEN }}" "https://api.github.com/users/${member}/events") if [[ $(echo "$member_commits" | jq length) -gt 0 ]]; then # Extracting commit-related data (commit ID, name, time, message, link) - commits_data=$(echo "$member_commits" | jq -r 'map(select(.type == "PushEvent")) | .[].payload.commits[] | {commitId: .sha, userName: .author.name, commitTime: .created_at, commitMessage: .message, commitLink: .url }') + # commits_data=$(echo "$member_commits" | jq -r 'map(select(.type == "PushEvent")) | .[].payload.commits[] | {commitId: .sha, userName: .author.name, commitTime: .created_at, commitMessage: .message, commitLink: .url }') + commits_data=$(echo "$member_commits" | jq -r 'map(select(.type == "PushEvent")) | .[] | {commitId: .payload.commits[0].sha, userName: .payload.commits[0].author.name, commitTime: .created_at, commitMessage: .payload.commits[0].message, commitLink: .payload.commits[0].url }') # Append the commit data to the member's entry in all_commits all_commits+=("$member: $commits_data")