guibranco / projects-monitor

⚙️🔔 GitHub projects monitor
https://guilherme.straccini.com/projects-monitor/
MIT License
3 stars 0 forks source link

[FEATURE] Grab information from Codecov #19

Open guibranco opened 1 year ago

guibranco commented 1 year ago

Description:

We need to create an integration with the CodeCov API to fetch and store relevant code coverage information for each repository. The task involves querying the repositories table, calling the CodeCov API for each repository, and storing the results in a new dedicated table. The table will store only key information (e.g., coverage percentage, number of lines covered, and total lines), avoiding detailed data to keep it lightweight.

Objectives:

  1. Create CodeCov API Integration:

    • Develop a PHP integration class to interact with the CodeCov API.
  2. Query the Repositories Table:

    • Retrieve the list of repositories from the existing repositories table.
  3. Call the CodeCov API for Each Repository:

    • Use the new integration class to call the API and retrieve code coverage data for each repository.
  4. Create a New Database Table:

    • Design a new table to store only the key information retrieved from the CodeCov API.
  5. Store Relevant Data:

    • Parse the API response and store the relevant data in the new table.

Tasks:

Code Example:

Here’s a basic pseudo-code example to demonstrate how the integration might work:

// Fetch repositories from the database
$repositories = $database->query('SELECT id, name FROM repositories');

// Instantiate CodeCov integration class
$codeCov = new CodeCovIntegration('YOUR_API_KEY');

foreach ($repositories as $repository) {
    // Call CodeCov API for each repository
    $codeCovData = $codeCov->fetchRepositoryCoverage($repository['name']);

    // Parse relevant data from the API response
    $coveragePercentage = $codeCovData['coverage']['percentage'];
    $linesCovered = $codeCovData['coverage']['covered_lines'];
    $totalLines = $codeCovData['coverage']['total_lines'];

    // Insert the relevant data into the new table
    $database->query('INSERT INTO codecov_info (repository_id, coverage_percentage, lines_covered, total_lines) 
                      VALUES (?, ?, ?, ?)', 
                      [$repository['id'], $coveragePercentage, $linesCovered, $totalLines]);
}

Acceptance Criteria:

Additional Context:

By integrating with CodeCov, we can track and monitor code coverage for each repository, providing useful insights into the health and quality of the codebase. This data will be lightweight and easy to query for further use in dashboards or reporting.

gitauto-ai[bot] commented 3 weeks ago

Hey, I'm a bit lost here! Not sure which file I should be fixing. Could you give me a bit more to go on? Maybe add some details to the issue or drop a comment with some extra hints? Thanks!

Have feedback or need help? Feel free to email info@gitauto.ai.