creightontaylor / simple_website

0 stars 0 forks source link

Generate Daily GitHub Summary Report #26

Open creightontaylor opened 1 month ago

creightontaylor commented 1 month ago

Description:

Create a simple automated task that demonstrates Sif Task Force's ability to handle repetitive development tasks. The task involves generating a daily summary report from a GitHub repository, including the number of commits, open issues, and closed issues. The report should be formatted in markdown and saved in the repository.

Background/Context:

This demo aims to showcase the basic automation capabilities of Sif Task Force, allowing developers to see how the tool can offload routine tasks. The focus should be on simplicity and clear demonstration of the automation process.

Task Details:

Task Name: Generate Daily GitHub Summary Report Frequency: Daily Repository: https://github.com/creightontaylor/simple_website Content of the Report: Date of the report Number of commits made on that day List of commits with commit messages and author names Number of open issues Number of closed issues Format: Markdown Destination: Save the report as daily_summary.md in the root of the repository. Steps to Implement:

Setup Task:

Configure the task to run daily at a specified time. Ensure the task can authenticate and access the provided GitHub repository. Data Collection:

Fetch the number of commits made on the day. Retrieve commit messages and author names. Count the number of open issues. Count the number of closed issues. Report Generation:

Format the collected data into a markdown report. Include the date, commit count, commit details, and issue counts. Saving the Report:

Save the generated markdown report as daily_summary.md in the root directory of the repository. Acceptance Criteria:

Report Accuracy:

The report should accurately reflect the number of commits, open issues, and closed issues for the day. Report Formatting:

The report should be well-formatted in markdown. Automation:

The task should run automatically at the specified time each day without manual intervention. Saving the Report:

The report should be correctly saved in the specified location within the repository. User Stories:

As a developer, I want to see how Sif Task Force can automate daily reporting tasks so that I can save time on routine activities. As a project manager, I want to receive a daily summary report of the repository to stay updated on the project's progress without manually checking GitHub.

creightontaylor commented 1 month ago

1. πŸ“ Indexing

I'm indexing the files within your repository.

Successfully indexed!

2. πŸ”Ž Searching

I'm searching for relevant snippets in your repository.

It seems there was a misunderstanding in the task request. My current capabilities do not allow me to directly interact with external systems, such as GitHub repositories, to perform actions like generating reports, committing changes, or configuring automation scripts. My functionality is limited to processing and generating text-based responses based on the input provided to me.

However, I can guide you through the process of setting up such an automation using GitHub Actions, a popular CI/CD tool that can automate this task within the GitHub environment. Here's a high-level overview of how you could set up an automated daily summary report for a GitHub repository:

  1. GitHub Actions Workflow Setup: You would create a .yml file under .github/workflows in your repository to define the workflow.

  2. Schedule the Workflow: Use a cron schedule to run the workflow at a specified time each day. For example, 0 0 * * * would run it at midnight UTC.

  3. Authenticate with GitHub: The workflow has built-in GitHub authentication through the GITHUB_TOKEN secret.

  4. Gather Data:

    • Use GitHub's REST API to fetch the day's commits, open issues, and closed issues. The endpoints you might need include:
      • List commits: GET /repos/{owner}/{repo}/commits
      • List issues: GET /repos/{owner}/{repo}/issues
    • Filter the data based on the date and status (for issues).
  5. Generate the Report: Format the fetched data into markdown format. You can use a script written in Python, JavaScript, or any language supported by GitHub Actions runners.

  6. Commit the Report: Use git commands within the workflow to commit the daily_summary.md file back to the repository.

Here's a simplified example of what the GitHub Action workflow might look like:

name: Daily Summary Report

on:
  schedule:
    - cron: '0 0 * * *' # Runs at midnight UTC

jobs:
  generate-report:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Generate Report
      run: |
        # Placeholder for script to generate report
        echo "Report generated" > daily_summary.md
    - name: Commit and Push
      run: |
        git config --global user.name 'GitHub Actions'
        git config --global user.email 'actions@github.com'
        git add daily_summary.md
        git commit -m "Daily Summary Report"
        git push

This example is quite basic and would need to be expanded with the actual scripts to fetch data from GitHub's API, generate the markdown report, and handle any edge cases or errors.

For detailed guidance on GitHub Actions, the GitHub REST API, and working with markdown, I recommend consulting the official GitHub documentation and resources on these topics.

View Snippets

3. 🌐 Planning

I'm creating a plan for the discussion and coding steps.

πŸ’‘ Steps

Step 1 - Create GitHub Actions Workflow File

creightontaylor commented 1 month ago

Considering the workflow and the concerns raised, I propose a revised workflow that addresses error handling, data processing logic, cron schedule configuration, script language compatibility, API rate limiting, security and permissions, report commit conflicts, workflow failure notifications, dependency management, and performance optimization.

Revised Workflow:

  1. Enhanced Error Handling: Modify the GitHub Actions workflow to include comprehensive error handling for each step, especially when fetching data using GitHub's REST API. Use try/catch blocks and conditional steps to manage errors gracefully.

  2. Data Processing and Validation: Integrate a step for validating the fetched data before processing. This ensures the integrity of the data and reduces processing errors. Consider using a more structured approach, like JSON schema validation.

  3. Cron Schedule Review: Add a step to validate the cron schedule syntax automatically using a linting tool or script. This ensures the schedule is correctly configured to run at the intended times.

  4. Script Compatibility Check: Include a pre-check step to ensure the scripting language chosen for the report generation is supported by the current GitHub Actions runner environment. This step should also handle the installation of any necessary dependencies.

  5. API Rate Limit Management: Implement caching mechanisms and conditional fetching logic to minimize the number of API requests. This can help in staying within the GitHub API rate limits.

  6. Security and Permissions Audit: Before executing the workflow, add a step to verify that all necessary permissions are correctly configured. This step should also ensure that the principle of least privilege is followed.

  7. Conflict-Free Report Committing: Implement a strategy to avoid conflicts when committing the report, such as using a dedicated branch or checking for changes before committing.

  8. Workflow Failure Notifications: Configure automated notifications (e.g., email, Slack) for workflow failures to ensure immediate awareness and response.

  9. Dependency Management: Use a dependency management tool to ensure all dependencies are up to date. Regularly review and update the workflow to use the latest versions of tools and languages.

  10. Performance Profiling and Optimization: Regularly profile the workflow to identify and address any bottlenecks. Optimize the script and GitHub Actions steps for better performance and efficiency.

This revised workflow aims to address the concerns raised and improve the reliability, security, and efficiency of the daily GitHub summary report generation process.