contributors icon indicating copy to clipboard operation
contributors copied to clipboard

Contribution count in Org report is not limited to date range

Open kontu opened this issue 1 year ago • 0 comments

Describe the bug

When generating the report against an Organization using start_date and end_date, the Contributions Count is equal to the all time contributions for any repos in the report

In a report created, Top contributor has contributed to one repo in the time span. See screenshots for I would expect their Contribution Count to be ~8 in the report; not 476

To Reproduce

  • Create new repo with only this action with below code to get a short weeks period
  • Trigger report generation via workflow_dispatch
name: Weekly contributor report
on:
  workflow_dispatch:
  # schedule:
  #   - cron: '0 4 * * 1'

permissions:
  contents: read

jobs:
  contributor_report:
    name: contributor report
    runs-on: ubuntu-latest
    permissions:
      issues: write

    steps:
      - name: Get dates for last week
        shell: bash
        run: |
          # Calculate the first day of the previous week
          start_date=$(date -d "last-sunday" +%Y-%m-%d)
  
          # Calculate the last day of the previous week
          end_date=$(date -d "$start_date +1 week -1 day" +%Y-%m-%d)
  
          #Set an environment variable with the date range
          echo "START_DATE=$start_date" >> "$GITHUB_ENV"
          echo "START_DATE=$start_date"
          echo "END_DATE=$end_date" >> "$GITHUB_ENV"
          echo "END_DATE=$end_date"

  
      - name: Run contributor action
        uses: github/[email protected]
        env:
          GH_APP_ID: ${{ secrets.GH_APP_ID }}
          GH_APP_INSTALLATION_ID: ${{ secrets.GH_APP_INSTALLATION_ID }}
          GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }}
          START_DATE: ${{ env.START_DATE }}
          END_DATE: ${{ env.END_DATE }}
          ORGANIZATION: "XXXX"
          SPONSOR_INFO: "false"
      - name: Create issue
        uses: peter-evans/create-issue-from-file@v5
        with:
          title: Contributor report for ${{ env.START_DATE }} - ${{ env.END_DATE }}
          content-filepath: ./contributors.md
          assignees: xxxxxxxxx

Expected behavior

  • User has contributed in the date range
  • Contribution Count reflects contributions performed only during the date range

Screenshots

Generated report for 1 week: image image

Additional context

Referencing reports in this repo to narrow down when this changed

  • https://github.com/github/contributors/issues/56 seems to correctly only count contributions from the time period
  • https://github.com/github/contributors/issues/61 is the first report I find in this repo that shows total contribution count instead of time period
  • This makes me suspect it may have been introduced around release v1.1.2 ; however as i have installed as github app I can not downgrade to test at this time

kontu avatar Jul 02 '24 18:07 kontu