Skip to content

Conversation

AbhishekAg
Copy link
Contributor

@AbhishekAg AbhishekAg commented Jul 26, 2025

Fixes: #3649.

This PR implements support for the "List repository activities" REST API endpoint introduced in GitHub API v2022-11-28. This functionality allows go-github users to retrieve detailed activity information for repositories.

Implementation Details

  • Added RepositoryActivity struct to represent activity data returned by the API
  • Created ListRepositoryActivitiesOptions for pagination and filtering options (direction, before/after timestamps)
  • Implemented ListActivities method in the RepositoriesService
  • Added comprehensive tests for the new functionality
  • Updated documentation with usage examples

API Reference
This implementation follows the GitHub REST API specification documented at:
https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-activities
Example Usage

opts := &github.ListRepositoryActivitiesOptions{
    Direction: "desc",
    After:     "2023-01-01T00:00:00Z",
    ListOptions: github.ListOptions{
        Page:    1,
        PerPage: 30,
    },
}

activities, resp, err := client.Repositories.ListActivities(ctx, "owner", "repo", opts)

Testing

The implementation includes unit tests that verify:

  • Correct URL formatting and parameter handling
  • Proper deserialization of API responses
  • Edge cases (empty results, error handling)

Adds support for the /repos/{owner}/{repo}/activity REST API endpoint.
This implements the List Repository Activities functionality introduced
in GitHub API v2022-11-28, allowing clients to retrieve detailed
activity data for repositories.

Includes:
- New RepositoryActivity struct and related types
- ListRepositoryActivitiesOptions for pagination and filtering
- Implementation in RepositoriesService with tests
- Documentation with examples

Ref: google#3649

Signed-off-by: abhishek <[email protected]>
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @AbhishekAg.
Please address these items, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Jul 26, 2025
Signed-off-by: abhishek <[email protected]>
@AbhishekAg AbhishekAg requested a review from gmlewis July 27, 2025 11:52
Copy link

codecov bot commented Jul 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.25%. Comparing base (9f2b91b) to head (a90671a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3651   +/-   ##
=======================================
  Coverage   91.25%   91.25%           
=======================================
  Files         184      184           
  Lines       16311    16327   +16     
=======================================
+ Hits        14884    14900   +16     
  Misses       1245     1245           
  Partials      182      182           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @AbhishekAg!
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

@stevehipwell or @alexandear - might one of you have time for a code review? Thank you!

@AbhishekAg AbhishekAg requested a review from alexandear July 28, 2025 11:29
@AbhishekAg
Copy link
Contributor Author

@alexandear Please review the PR when you get time.

@AbhishekAg AbhishekAg requested a review from alexandear July 29, 2025 17:23
@AbhishekAg
Copy link
Contributor Author

@gmlewis @alexandear Can you please push these changes to the protected branch? I am not allowed to perform the push.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Jul 29, 2025
@gmlewis
Copy link
Collaborator

gmlewis commented Jul 29, 2025

Thank you, @alexandear!
Merging.

@gmlewis gmlewis merged commit f46ce36 into google:master Jul 29, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement REST API Endpoint for List Repository Activities
3 participants