{"id":22682188,"url":"https://github.com/andry81-devops/github-accum-stats","last_synced_at":"2025-04-12T17:25:00.700Z","repository":{"id":55611695,"uuid":"430249810","full_name":"andry81-devops/github-accum-stats","owner":"andry81-devops","description":"Tutorial to setup accumulation of various GitHub repository/account statistic. • :page_with_curl: https://github.com/andry81-stats/github-accum-stats--gh-stats :page_with_curl:","archived":false,"fork":false,"pushed_at":"2025-02-03T01:29:49.000Z","size":35,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T11:44:55.467Z","etag":null,"topics":["actions","devops","github","github-action","github-statistics","statistics","tutorial","workflow"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andry81-devops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://github.com/andry81/donate"]}},"created_at":"2021-11-21T01:46:13.000Z","updated_at":"2025-02-03T01:29:53.000Z","dependencies_parsed_at":"2024-02-18T04:27:28.508Z","dependency_job_id":"0c2201d7-3fed-4228-a55a-4d49b1824b2c","html_url":"https://github.com/andry81-devops/github-accum-stats","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andry81-devops%2Fgithub-accum-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andry81-devops%2Fgithub-accum-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andry81-devops%2Fgithub-accum-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andry81-devops%2Fgithub-accum-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andry81-devops","download_url":"https://codeload.github.com/andry81-devops/github-accum-stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248603207,"owners_count":21131761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","devops","github","github-action","github-statistics","statistics","tutorial","workflow"],"created_at":"2024-12-09T20:25:40.211Z","updated_at":"2025-04-12T17:25:00.694Z","avatar_url":"https://github.com/andry81-devops.png","language":null,"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/andry81-stats/github-accum-stats--gh-stats/commits/master/traffic/views\"\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/views/all.svg\" valign=\"middle\" alt=\"GitHub views|any|total\" /\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/views/all-14d.svg\" valign=\"middle\" alt=\"GitHub views|any|14d\" /\u003e\u003c/a\u003e\n• \u003ca href=\"https://github.com/andry81-stats/github-accum-stats--gh-stats/commits/master/traffic/views\"\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/views/unq.svg\" valign=\"middle\" alt=\"GitHub views|unique per day|total\" /\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/views/unq-14d.svg\" valign=\"middle\" alt=\"GitHub views|unique per day|14d\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/andry81-stats/github-accum-stats--gh-stats/commits/master/traffic/clones\"\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/clones/all.svg\" valign=\"middle\" alt=\"GitHub clones|any|total\" /\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/clones/all-14d.svg\" valign=\"middle\" alt=\"GitHub clones|any|14d\" /\u003e\u003c/a\u003e\n• \u003ca href=\"https://github.com/andry81-stats/github-accum-stats--gh-stats/commits/master/traffic/clones\"\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/clones/unq.svg\" valign=\"middle\" alt=\"GitHub clones|unique per day|total\" /\u003e\n    \u003cimg src=\"https://github.com/andry81-cache/andry81-devops--gh-content-cache/raw/master/repo/andry81-devops/github-accum-stats/badges/traffic/clones/unq-14d.svg\" valign=\"middle\" alt=\"GitHub clones|unique per day|14d\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/andry81/donate\"\u003e\u003cimg src=\"https://github.com/andry81-cache/gh-content-static-cache/raw/master/common/badges/donate/donate.svg\" valign=\"middle\" alt=\"donate\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n# Tutorial to setup accumulation of various GitHub repository/account statistic\n\n\u003e [!TIP]\n\u003e This implementation is based on that: https://github.com/andry81-devops/github-clone-count-badge\n\n\u003e [!WARNING]\n\u003e This tutorial is contain content related to the GitHub itself. All other description has moved into other tutorials.\n\nAll tutorials: https://github.com/andry81/index#tutorials\n\n## Features:\n\n1. Implementation can accumulate GitHub traffic clones or/and views, GitHub account rate limits of an authenticated user.\n\n2. Workflow has used a bash script to accumulate statistic:\n\n   * GitHub traffic clones/views: [accum-stats.sh](https://github.com/andry81-devops/gh-workflow/tree/HEAD/bash/github/accum-stats.sh)\n\n   * GitHub account rate limits: [accum-rate-limits.sh](https://github.com/andry81-devops/gh-workflow/tree/HEAD/bash/github/accum-rate-limits.sh)\n\n3. Basically most of the scripts does accumulate the response. For example, the clones accumulator script does accumulate statistic both into a single file: `traffic/clones/latest-accum.json`,\n   and into a set of files grouped by year and allocated per day: `traffic/clones/by_year/YYYY/YYYY-MM-DD.json`.\n\n4. A repository based accumulator script has a repository to track and a repository to store traffic statistic and they may be different. If they is different, then you can directly point the statistic as a standalone commits list: `https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/clones`.\n\n5. All scripts does use GitHub composite action to reuse workflow code base: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action\n\n\u003e [!WARNING]\n\u003e Not all features of a generic GitHub action is supported: [Known Issues](#known-issues)\n\n## Repositories:\n\nYou need setup 3-4 repositories.\n\n1. Repository which statistic you want to track: `myrepo`.\u003cbr /\u003e\n   \u003e [!NOTE]\n   \u003e This repository is only required for repository based statistic scripts.\n\n2. Repository, where statistic will be saved: `myrepo--gh-stats`.\u003cbr /\u003e\n   \u003e [!NOTE]\n   \u003e You still can use a single repository to request and to store, but it is not convenient and will distort the clone statistic (at least until the GitHub action user who is used to checkout the statistic output repository won't be involved into clones counter change), so is not recommended.\n\n3. Repository, where to store github workflow support scripts: `gh-workflow`.\u003cbr /\u003e\n   You can fork or use it from here: https://github.com/andry81-devops/gh-workflow\n\n4. Repository, where to store github composite action:\n\n   * GitHub composite action to request and accumulate a repository clones/views statistic:\u003cbr /\u003e\n     https://github.com/andry81-devops/gh-action--accum-gh-stats\n\n   * GitHub composite action to request and accumulate an account rate limits:\u003cbr /\u003e\n     https://github.com/andry81-devops/gh-action--accum-gh-rate-limits\n\n   All action scripts:\u003cbr /\u003e\n   https://github.com/andry81/index#action-scripts\n\n\u003e [!NOTE]\n\u003e See \u003ca href=\"#reuse\"\u003eREUSE\u003c/a\u003e section for details if you have multiple repositories and want to store all GitHub workflow scripts (`.github/workflows/*.yml`) in a single repository.\n\n\u003e [!NOTE]\n\u003e You need to attach a personal access token (PAT) into a repository used to run a GitHub action script (`.github/workflows/*.yml`) to read content from another repository and obtain the read permission from that repository: `repo`-\u003e`public_repo`.\n\n\u003e [!NOTE]\n\u003e You need to attach a personal access token (PAT) into a repository used to run a GitHub action script (`.github/workflows/*.yml`) to write content into another repository and obtain the push permission into that repository: `repo`.\n\n\u003e [!NOTE]\n\u003e You need to attach a personal access token (PAT) into a repository used to run a GitHub action script (`.github/workflows/*.yml`) to read statistic of another repository and obtain the push permission into that repository: `repo`.\n\n\u003e [!NOTE]\n\u003e A separate personal access token (PAT) does not require to be attached into a repository used to run a GitHub action script for another repository as long as that another repository is owned by the same owner as a repository which runs a GitHub action script.\n\n* `myrepo` -\u003e needs read/write access permissions to read repository statistic as not public repository metadata (not files)\n* `myrepo--gh-stats` -\u003e needs read/write access permissions to read/write repository files\n\nTo generate PAT: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token\n\nTo attach PAT: https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository\n\n\u003e [!WARNING]\n\u003e Beginning from the `gh-workflow` `1.3.0` as a dependency to all action scripts the checkout action script https://github.com/actions/checkout can be replaced by a wrapper script https://github.com/andry81-devops/gh-action--git-checkout which does support checkout from an empty repository and you can leave an output repository empty before the first checkout.\n\u003e Now the initial output repository state is not required as input. The information about initial output repository state is removed from here.\n\nThe `myrepo` repository should contain 1 file per statistic entity:\n\n* [.github/workflows/accum-gh-clone-stats.yml example](https://github.com/andry81-devops/gh-action--accum-gh-stats#accum-gh-clone-stats-yml)\n\n* [.github/workflows/accum-gh-view-stats.yml example](https://github.com/andry81-devops/gh-action--accum-gh-stats#accum-gh-view-stats-yml)\n\n* [.github/workflows/accum-gh-rate-limits.yml example](https://github.com/andry81-devops/gh-action--accum-gh-rate-limits#accum-gh-rate-limits-yml)\n\n\u003e [!WARNING]\n\u003e You must replace all placeholder into respective values:\n\n* `{{REPO_OWNER}}` -\u003e repository owner\n* `{{REPO}}` -\u003e `myrepo`\n\nAfter the github workflow yaml file is commited and pushed, you can run the action from the `Actions` tab in the `myrepo` repository.\n\nAfter that you can add badges to reference a repository statistic:\n\n```xml\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/views\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=Github%20views|all\u0026query=count\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/views/latest-accum.json?raw=True\u0026logo=github\" valign=\"middle\" alt=\"GitHub views|any|total\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=14d\u0026query=count\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/views/latest.json?raw=True\" valign=\"middle\" alt=\"GitHub views|any|14d\" /\u003e\u003c/a\u003e\n• \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/views\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=Github%20views|unq\u0026query=uniques\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/views/latest-accum.json?raw=True\u0026logo=github\" valign=\"middle\" alt=\"GitHub views|unique per day|total\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=14d\u0026query=uniques\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/views/latest.json?raw=True\" valign=\"middle\" alt=\"GitHub views|unique per day|14d\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/clones\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=Github%20clones|all\u0026query=count\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/clones/latest-accum.json?raw=True\u0026logo=github\" valign=\"middle\" alt=\"GitHub clones|any|total\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=14d\u0026query=count\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/clones/latest.json?raw=True\" valign=\"middle\" alt=\"GitHub clones|any|14d\" /\u003e\u003c/a\u003e\n• \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/clones\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=Github%20clones|unq\u0026query=uniques\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/clones/latest-accum.json?raw=True\u0026logo=github\" valign=\"middle\" alt=\"GitHub clones|unique per day|total\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=success\u0026label=14d\u0026query=uniques\u0026url=https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/raw/master/traffic/clones/latest.json?raw=True\" valign=\"middle\" alt=\"GitHub clones|unique per day|14d\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n```\n\n\u003e [!NOTE]\n\u003e There is https://github.com/andry81-devops/gh-action--accum-content action script which can periodically download all the dynamic badges and other files into a content cache repository.\n\nYou can add links pointing a content cache repository instead, to leave the `README.md` a bit simplier:\n\n```xml\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/views\"\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/views/all.svg\" valign=\"middle\" alt=\"GitHub views|any|total\" /\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/views/all-14d.svg\" valign=\"middle\" alt=\"GitHub views|any|14d\" /\u003e\u003c/a\u003e\n• \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/views\"\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/views/unq.svg\" valign=\"middle\" alt=\"GitHub views|unique per day|total\" /\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/views/unq-14d.svg\" valign=\"middle\" alt=\"GitHub views|unique per day|14d\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/clones\"\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/clones/all.svg\" valign=\"middle\" alt=\"GitHub clones|any|total\" /\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/clones/all-14d.svg\" valign=\"middle\" alt=\"GitHub clones|any|14d\" /\u003e\u003c/a\u003e\n• \u003ca href=\"https://github.com/{{REPO_OWNER}}/{{REPO}}--gh-stats/commits/master/traffic/clones\"\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/clones/unq.svg\" valign=\"middle\" alt=\"GitHub clones|unique per day|total\" /\u003e\n    \u003cimg src=\"https://github.com/{{REPO_OWNER}}-cache/{{REPO_OWNER}}--gh-content-cache/raw/master/repo/{{REPO_OWNER}}/{{REPO}}/badges/traffic/clones/unq-14d.svg\" valign=\"middle\" alt=\"GitHub clones|unique per day|14d\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n```\n\n##Features of a standalone content cache repository:\n\nhttps://github.com/andry81-devops/accum-content#features-of-a-standalone-content-cache-repository\n\n## REUSE\n\n\u003e [!WARNING]\n\u003e The GitHub does disable all workflow scripts in case of repository main branch inactivity for a period of time: [Known Issues](#known-issues)\n\nYou can reuse all workflow scripts from a single repository to ease the maintain and scripts edit.\n\nFor example, if you have 3 repositories `myrepo1`, `myrepo2`, `myrepo3` and the repository owner is `user`, then you can put all workflow scripts into a single repository `github.com/user/user/.github/workflows` in this way:\n\n* `myrepo1.accum-gh-clone-stats.yml`\n* `myrepo1.accum-gh-view-stats.yml`\n* `myrepo2.accum-gh-clone-stats.yml`\n* `myrepo2.accum-gh-view-stats.yml`\n* `myrepo3.accum-gh-clone-stats.yml`\n* `myrepo3.accum-gh-view-stats.yml`\n\nAnd use slightly different naming:\n\n```yml\nname: \"myrepo1: GitHub clones counter for 14 days at every 8 hours and clones accumulator\"\n```\n\n```yml\nname: \"myrepo1: GitHub views counter for 14 days at every 8 hours and views accumulator\"\n```\n\n\u003e [!NOTE]\n\u003e If you have multiple repositories to store the statistic, then you can create a github organization account like `\u003cowner\u003e-stats` and move all statistic repositories into organization's account.\n\u003e It will leave the repositories page of the original account untouched on each commit into an organization account repository.\n\n## Known Issues\n\nhttps://github.com/andry81-devops/gh-known-issues#known-issues\n\n## Last known issues updates\n\nhttps://github.com/andry81-devops/gh-known-issues#last-known-issues-updates\n","funding_links":["https://github.com/andry81/donate"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandry81-devops%2Fgithub-accum-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandry81-devops%2Fgithub-accum-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandry81-devops%2Fgithub-accum-stats/lists"}