python-github-backup icon indicating copy to clipboard operation
python-github-backup copied to clipboard

Proposal to use API repository `pushed_at` instead of `update_at` field for `last_updated`

Open kenbailey opened this issue 3 years ago • 0 comments

The last_updated timestamp file used by the --incremental option is being set by the updated_at field in the GitHub Repositories API. However, the updated_at field appears to only gets updated with specific types of activities (i.e., it doesn't get updated with code pushes even).

https://stackoverflow.com/questions/15918588/github-api-v3-what-is-the-difference-between-pushed-at-and-updated-at

Thus the --incremental option is using a since date in the API call that could be older than the last time the script was run. In my case with 90+ repositories, the last_updated is currently 3 weeks behind.

The pushed_at field for the repositories is updated for things like code pushes. I'd be willing to submit a PR, if this makes sense. It would replace the updated_at for pushed_at.

https://github.com/josegonzalez/python-github-backup/blob/07e32b186c98a1941213b38864fcddc8aa29f827/github_backup/github_backup.py#L771

An alternative approach would be to get the max of either updated_at and pushed_at . There are scenarios when updated_at is a later date.

Thanks, this script is working wonderfully for us.

kenbailey avatar Feb 28 '23 17:02 kenbailey