creightontaylor / simple_website

0 stars 0 forks source link

Generate Daily GitHub Summary Report #32

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.

This task does not require code snippets from the repository.

View Snippets

3. 🌐 Planning

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

πŸ’‘ Steps

Step 1 - Create GitHub Action Workflow

5. 🎲 Assignment

Here is the finalized workflow:

Create GitHub Action Workflow **Action:** `create` **File:** `.github/workflows/daily_summary_report.yml` **Lines:** `[1, 20]` **Dependencies:** `[]` **Instructions:** `Create a new GitHub Action workflow file named 'daily_summary_report.yml' in the '.github/workflows' directory. This workflow should be configured to run daily at a specified time using the cron syntax in the 'on' section. Include steps for checking out the repository and setting up Python environment for running the script that generates the daily summary report.` **Agent:** `Software engineer`
Create Python Script for Data Fetching and Report Generation **Action:** `create` **File:** `scripts/generate_daily_summary.py` **Lines:** `[1, 50]` **Dependencies:** `['Step 1']` **Instructions:** `Create a Python script named 'generate_daily_summary.py' in a new 'scripts' directory. This script should use the GitHub API to fetch the day's commits, commit details (messages and author names), and the current status of issues (open and closed counts). Implement error handling for API rate limits, network issues, and data processing errors. Use GitHub Secrets for API token management and ensure user-generated content is sanitized to prevent injection attacks. Add pagination to handle large data volumes efficiently.` **Agent:** `Software engineer`
Modify GitHub Action to Run Python Script **Action:** `modify` **File:** `.github/workflows/daily_summary_report.yml` **Lines:** `[21, 25]` **Dependencies:** `['Step 1', 'Step 2']` **Instructions:** `Modify the 'daily_summary_report.yml' workflow file to add a step that runs the 'generate_daily_summary.py' script. This step should be configured to use the GitHub Secrets for API token access. Ensure the Python environment is set up correctly before this step.` **Agent:** `Software engineer`
Create Markdown Report File **Action:** `create` **File:** `daily_summary.md` **Lines:** `[1, 10]` **Dependencies:** `['Step 2']` **Instructions:** `After the 'generate_daily_summary.py' script successfully fetches the necessary data and processes it, create a markdown file named 'daily_summary.md' in the root directory. The script should format the fetched data into markdown format, including the date, the number of commits with details, and the counts of open and closed issues. Ensure proper markdown formatting for readability.` **Agent:** `Software engineer`
Modify Python Script to Commit and Push Report **Action:** `modify` **File:** `scripts/generate_daily_summary.py` **Lines:** `[51, 60]` **Dependencies:** `['Step 2', 'Step 4']` **Instructions:** `Modify the 'generate_daily_summary.py' script to add functionality for committing and pushing the 'daily_summary.md' file to the repository after it is generated. Use git commands within the script to add, commit, and push the file. Ensure the script includes error handling for potential git operation failures.` **Agent:** `Software engineer`
creightontaylor commented 1 month ago

Considering the workflow and the concerns listed, I recommend incorporating a more detailed error handling and logging mechanism into both the GitHub Action workflow and the Python script. Specifically, for the GitHub Action, we should include steps to capture and report errors that occur during the execution of the Python script. This could involve capturing the script's exit code and, if it indicates failure, sending a notification to the team (e.g., via email or Slack). For the Python script, enhancing error handling to include more specific exceptions for API rate limits, network issues, and data processing errors would be beneficial. This should be coupled with detailed logging that can be reviewed for troubleshooting and ensuring data accuracy. Additionally, considering the potential for large data volumes, implementing a pagination mechanism in the data fetching process could prevent timeouts and ensure the script remains performant. Lastly, to address security concerns, the script should include measures to securely manage API tokens, possibly by leveraging GitHub Secrets, and sanitize any user-generated content to prevent injection attacks in the markdown report.

creightontaylor commented 1 month ago

Could we consider implementing a feature to notify relevant stakeholders (e.g., project managers, developers) via email or GitHub notifications when the daily summary report is generated? This could enhance visibility and ensure that the report is promptly reviewed.

creightontaylor commented 1 month ago

Regarding the concern about GitHub API rate limiting, have we considered the specific thresholds we're likely to encounter based on our expected usage patterns? Additionally, is there a plan in place for handling potential rate limit exceeded errors beyond the initial error handling strategy, such as a retry mechanism with exponential backoff?

creightontaylor commented 1 month ago

Given the comprehensive workflow and the concerns listed, I suggest incorporating a more robust error handling and logging mechanism across the entire process. Specifically, for the GitHub Action, it would be beneficial to include steps for capturing and reporting errors that occur not just in the execution of the Python script, but also in any preliminary setup steps. This could involve capturing the script's exit code and, if it indicates failure, sending a detailed notification to the team, which could include error logs and a suggestion for immediate actions or checks. For the Python script, enhancing error handling to cover more specific exceptions related to the GitHub API's rate limits, network issues, and data processing errors would provide clearer insights into failures and potential performance bottlenecks. This should be coupled with detailed logging that can be easily accessed for troubleshooting purposes. Additionally, to ensure the script's performance remains optimal even as data volumes grow, implementing efficient pagination and data fetching strategies is crucial. Lastly, to further secure the process, the script should employ more rigorous measures for managing API tokens, possibly by exploring more secure storage and access mechanisms beyond GitHub Secrets, and implement stringent sanitization of user-generated content to prevent injection attacks in the markdown report. This approach not only addresses the current concerns but also anticipates potential future challenges, making the automation process more resilient and maintainable.

creightontaylor commented 1 month ago

@creightontaylor The draft PR https://github.com/creightontaylor/simple_website/pull/34 from the issue https://github.com/creightontaylor/simple_website/issues/32 was created by SIF TaskForce. Please review and add comments. When it is ready for final review, please click on the 'Ready for Review' button and SIF TaskForce will take care of the rest.