ghatime

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 9 Imported by: 0

README

GitHub Actions Time Analyzer (ghatime)

ghatime is a command-line tool for analyzing the execution time of GitHub Actions within a specific GitHub organization. It aggregates data from multiple repositories and provides insights into the total and average run times of actions.

Features

  • Fetches and analyzes GitHub Actions execution time data from all repositories in a specified organization.
  • Calculates total and average execution times for each action.
  • Outputs analysis in a structured JSON format.

Installation

You can download the latest binary from the Releases page:

https://github.com/your_username/ghatime/releases

Choose the binary suitable for your platform (Windows, macOS, Linux), download it, and run it in your terminal.

Usage

To use ghatime, you need a GitHub Personal Access Token with appropriate permissions (e.g., repo, workflow). Set this token as an environment variable GITHUB_TOKEN:

export GITHUB_TOKEN="your_github_token"

Run ghatime with the required parameters:

./ghatime -o <organization> [--from <YYYY-MM-DD>] [--to <YYYY-MM-DD>]
  • -o, --org: The GitHub organization to analyze (required).
  • --from: Start date for the analysis in YYYY-MM-DD format (optional).
  • --to: End date for the analysis in YYYY-MM-DD format (optional).

If --from and --to are not specified, ghatime analyzes the last 7 days by default.

Example
./ghatime -o myorg --from 2023-01-01 --to 2023-01-31 >> output.json

This command analyzes the execution time of GitHub Actions for all repositories in the myorg organization from January 1, 2021, to January 31, 2021.

Output

The output is a JSON structure containing the organization name, a list of repositories, and their respective actions' execution times. Here is an example:

{
    "org": "myorg",
    "repos": [
        {
            "name": "repo1",
            "totalTime": 3600,
            "avgTime": 300,
            "jobs": [
                {
                    "name": "build",
                    "totalTime": 1800,
                    "avgTime": 300
                },
            ]
        },
    ]
}

Note

  • ghatime utilizes the GitHub API to fetch data. Be aware that the GitHub API has rate limits: up to 5000 requests per hour for authenticated requests. If you are working with a large number of repositories or workflows, you might reach this limit. Please use the tool judiciously. For more details, refer to the GitHub official documentation on rate limiting.

License

Code licensed under the MIT License.

Contributing

Instructions for contributing to the project, if open for contributions.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL