{"id":20295235,"url":"https://github.com/mattezekiel/get-commits-count","last_synced_at":"2026-04-09T07:57:38.462Z","repository":{"id":243941941,"uuid":"813848486","full_name":"MattEzekiel/get-commits-count","owner":"MattEzekiel","description":"Get every commit ever made (Public)","archived":false,"fork":false,"pushed_at":"2024-06-11T21:49:43.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T09:54:07.095Z","etag":null,"topics":["bash","javascript","puppeteer","scraper","yaml"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MattEzekiel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-06-11T21:32:22.000Z","updated_at":"2024-06-13T12:01:48.000Z","dependencies_parsed_at":"2024-06-12T05:49:10.977Z","dependency_job_id":"5e56f6df-9234-4a5c-9a5a-365aa1c1cc5e","html_url":"https://github.com/MattEzekiel/get-commits-count","commit_stats":null,"previous_names":["mattezekiel/get-commits-count"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattEzekiel%2Fget-commits-count","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattEzekiel%2Fget-commits-count/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattEzekiel%2Fget-commits-count/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattEzekiel%2Fget-commits-count/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MattEzekiel","download_url":"https://codeload.github.com/MattEzekiel/get-commits-count/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241790475,"owners_count":20020679,"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":["bash","javascript","puppeteer","scraper","yaml"],"created_at":"2024-11-14T15:33:52.290Z","updated_at":"2025-12-31T01:02:58.671Z","avatar_url":"https://github.com/MattEzekiel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📊 Count Commits GitHub Action\n\nThis GitHub Action counts the total number of commits in the repository and generates a badge with the commit count. The workflow runs on a schedule, on push events to the `main` branch, on pull requests targeting the `main` branch, and when manually triggered.\n\n## 📅 Trigger Events\n\nThe workflow is triggered by the following events:\n- ⏰ Scheduled run at the beginning of each month (`cron: '0 0 1 * *'`).\n- 📦 Push events to the `main` branch.\n- 📥 Pull request events targeting the `main` branch.\n- 🖱️ Manual workflow dispatch.\n- ![Endpoint Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FMattEzekiel%2Fget-commits-count%2Fmain%2Fexample.json) ![Commits](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2FMattEzekiel%2Fget-commits-count%2Fmain%2Fcommit-count-badge.json\u0026query=message\u0026label=Commits)\n\n## ⚙️ Workflow Details\n\n### 🏗️ Jobs\n\nThe workflow defines a single job called `count-commits` that runs on the latest Ubuntu environment (`ubuntu-latest`). This job includes the following steps:\n\n1. **🔄 Checkout repository**\n    - Uses the [actions/checkout@v2](https://github.com/actions/checkout) action to checkout the repository.\n\n2. **🔧 Set up Node.js**\n    - Uses the [actions/setup-node@v2](https://github.com/actions/setup-node) action to set up Node.js version 22.\n\n3. **📦 Install dependencies**\n    - Runs `npm install puppeteer` to install the Puppeteer library, which is used for web scraping.\n\n4. **🔍 Run scraper and generate commit badge**\n    - Runs a custom Node.js script (`scraper.js`) to count the total number of commits.\n    - Creates a JSON file (`commit-count-badge.json`) with the commit count to be used as a badge.\n\n5. **📤 Upload badge**\n    - Uses the [actions/upload-artifact@v2](https://github.com/actions/upload-artifact) action to upload the `commit-count-badge.json` file as an artifact.\n\n6. **📄 Commit and push badge update**\n    - Configures Git with a user name and email.\n    - Adds the `commit-count-badge.json` file to the repository.\n    - Commits the changes with a message \"Update commit badge\".\n    - Pushes the commit to the repository.\n\n## 🔑 Environment Variables\n\n- `GITHUB_TOKEN`: Required to authenticate with the GitHub API. This secret is automatically provided by GitHub Actions.\n\n## 📋 Example Usage\n\nTo use this workflow in your repository, create a file named `.github/workflows/count-commits.yml` and add the following content:\n\n```yaml\nname: Count Commits\n\non:\n  schedule:\n    - cron: '0 0 1 * *'\n  push:\n    branches: [ \"main\" ]\n  pull_request:\n    branches: [ \"main\" ]\n  workflow_dispatch:\n\njobs:\n  count-commits:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v2\n\n      # This code use Node.js\n      - name: Set up Node.js\n        uses: actions/setup-node@v2\n        with:\n          node-version: '22'\n\n      - name: Install dependencies\n        run: npm install puppeteer\n\n      - name: Run scraper and generate commit badge\n        id: commit-badge\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          TOTAL_COMMITS=$(node scraper.js)\n          echo \"Commits: $TOTAL_COMMITS\"\n          echo '{\"schemaVersion\": 1, \"label\": \"Commits\", \"message\": \"'\"$TOTAL_COMMITS\"' total\", \"color\": \"blue\"}' \u003e commit-count-badge.json\n\n      - name: Upload badge\n        uses: actions/upload-artifact@v2\n        with:\n          name: commit-badge\n          path: commit-count-badge.json\n\n      - name: Commit and push badge update\n        run: |\n          git config --local user.email \"action@github.com\"\n          git config --local user.name \"GitHub Action\"\n          git status\n          git add commit-count-badge.json\n          git commit -m \"Update commit badge\"\n          git push\n```\n\nEnsure you have the scraper.js script in your repository, which should contain the logic to count the commits.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattezekiel%2Fget-commits-count","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattezekiel%2Fget-commits-count","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattezekiel%2Fget-commits-count/lists"}