{"id":16775936,"url":"https://github.com/michmich112/gh-action-stats-js","last_synced_at":"2025-04-10T20:13:34.512Z","repository":{"id":45980089,"uuid":"403778491","full_name":"michmich112/gh-action-stats-js","owner":"michmich112","description":"Javascript package to get insight on your github action's performance through the GHA-Stats platform.","archived":false,"fork":false,"pushed_at":"2022-11-14T21:20:48.000Z","size":64,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T15:53:10.346Z","etag":null,"topics":["github-actions"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/gh-action-stats","language":"JavaScript","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/michmich112.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-06T23:02:38.000Z","updated_at":"2024-08-17T18:07:21.000Z","dependencies_parsed_at":"2022-09-26T18:41:17.397Z","dependency_job_id":null,"html_url":"https://github.com/michmich112/gh-action-stats-js","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michmich112%2Fgh-action-stats-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michmich112%2Fgh-action-stats-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michmich112%2Fgh-action-stats-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michmich112%2Fgh-action-stats-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michmich112","download_url":"https://codeload.github.com/michmich112/gh-action-stats-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288362,"owners_count":21078903,"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":["github-actions"],"created_at":"2024-10-13T07:08:15.259Z","updated_at":"2025-04-10T20:13:34.491Z","avatar_url":"https://github.com/michmich112.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github Actions Stats JS\n\nJavascript packager to get insight on your github action's performance through the GHA-Stats platform.\n\n## Getting Sarted\nFirst, install the package in your project by running\n\n```shell\nnpm install -S gh-action-stats\n```\n\nThen add it to the start of your custom GitHub action as follows:\n\n```javascript\nconst collectStats = require('gh-action-stats');\n\ncollectStats();\n```\nNow every time your action is used in a workflow you will be able to see the stats.\n\nTo collect execution time and errors you will have to wrap your main function in the collectStats function as such:\n```javascript\nconst collectStats = require('gh-action-stats');\n\n/**\n * main function, it must not have any parameters\n * The main function can also be an async function\n */\nfunction main() \n  console.log('This is the best GitHub action!');\n}\n\ncollectStats(main);\n```\n\nErrors thrown in the passed function are still thrown out.\n\n## Local\nStats will only be collected and saved if the `CI` environment variable is set to `true` (as is the case in CI environments including Github actions).\nAs such local runs where the `CI` environment variable is not set will not collect any data.\n\n## Stats Collected\nThe following information is collected:\n| Variable            | Description                                                                                                                                                                            |\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `GITHUB_RUN_ID`     | A unique number for each run within a repository. This number does not change if your re-run the workflow                                                                              |\n| `GITHUB_ACTION`     | The unique identifier (id) of the action (your custom action).                                                                                                                         |\n| `GITHUB_ACTOR`      | The name of the person or app that initiated the workflow. For example, `octocat`.                                                                                                     |\n| `GITHUB_REPOSITORY` | The owner of the repository name, For example, `octocat/Hello-World`.                                                                                                                  |\n| `GITHUB_EVEN_NAME`  | The name of the webhook event tha triggered the workflow.                                                                                                                              |\n| `GITHUB_REF`        | The branch or tag ref that triggered the workflow. For example, `refs/heads/feature-branch-1`.If neither a branch or tag is available for the event type, the variable will not exist. |\n| `GITHUB_HEAD_REF`   | Only set for pull request events. The name of the head branch.                                                                                                                         |\n| `GITHUB_BASE_REF`   | Only set for pull request events. The name of the base branch.                                                                                                                         |\n| `RUNNER_NAME`       | The name of the runner executing the job.                                                                                                                                              |\n| `RUNNER_OS`         | The operation system of the runner executing the job. Possible values are `Linux`, `Windows`, or `macOS`.                                                                              | \n\n## Usage Policy\nPlease make sure you state that you are using this package in your README as to make the users aware of the information collected.\n\n## Notes\nThis packages is made to work with node 12 or above.\n\n## Todo\n- [x] Runtime stats for debugging possible problems in runs.\n- [ ] Test on self hosted runners\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichmich112%2Fgh-action-stats-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichmich112%2Fgh-action-stats-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichmich112%2Fgh-action-stats-js/lists"}