Team Contributions Report #7
This file contains 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: "Team Contributions Report" | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight UTC | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
report: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all commits | |
- name: Checkout main branch | |
run: | | |
git checkout main | |
git pull origin main | |
- name: Count Commits on main by Author | |
id: count_commits | |
run: | | |
echo "Commits on main by author:" | |
git log --use-mailmap --pretty=format:"%an" main | sort | uniq -c | sort -nr > commits_by_author.txt | |
cat commits_by_author.txt | |
- name: Set up GitHub CLI | |
uses: cli/gh-actions@v2 | |
with: | |
gh-version: 'latest' | |
- name: Authenticate with GitHub CLI | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh auth login --with-token | |
- name: Count Merged PRs to main by Author | |
id: count_merged_prs | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Merged PRs to main by author:" | |
gh pr list --state merged --base main --json mergedBy --jq '.[] | .mergedBy.login' | sort | uniq -c | sort -nr > merged_prs_by_author.txt | |
cat merged_prs_by_author.txt | |
- name: Output Results | |
run: | | |
echo "Commits on main by author:" | |
cat commits_by_author.txt | |
echo "Merged PRs to main by author:" | |
cat merged_prs_by_author.txt |