SomethingGeneric / flaskpress

Wordpress but it's actually Python + Flask
GNU General Public License v3.0
0 stars 0 forks source link

Sweep: Modify test action to PR if black changes files #10

Closed SomethingGeneric closed 1 year ago

SomethingGeneric commented 1 year ago

Details

Ideally, the code formatter, if it changes files, should then open a pull request to submit back the formatted code as a PR. This can be after the tests are run.

Checklist - [X] `.github/workflows/test.yml` > • Add a new step after the Black code formatting step. This step should run a script that checks if there are any modified files using the git status command. > • If there are modified files, the script should commit these changes with a descriptive commit message. > • The script should then create a new pull request against the main branch using the GitHub CLI or the GitHub API. The title and body of the pull request should clearly indicate that it contains code formatting changes.
sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/SomethingGeneric/flaskpress/pull/11.

⚡ Sweep Free Trial: I used GPT-3.5 to create this ticket. You have 3 GPT-4 tickets left for the month and 0 for the day. For more GPT-4 tickets, visit our payment portal. To retrigger Sweep, edit the issue.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/SomethingGeneric/flaskpress/blob/7cdf4c5332e898b2bd1a3190e9ed7ff8ab7a4dca/LICENSE#L1-L48 https://github.com/SomethingGeneric/flaskpress/blob/7cdf4c5332e898b2bd1a3190e9ed7ff8ab7a4dca/LICENSE#L294-L639 https://github.com/SomethingGeneric/flaskpress/blob/7cdf4c5332e898b2bd1a3190e9ed7ff8ab7a4dca/LICENSE#L162-L306 https://github.com/SomethingGeneric/flaskpress/blob/7cdf4c5332e898b2bd1a3190e9ed7ff8ab7a4dca/README.md#L1-L1 https://github.com/SomethingGeneric/flaskpress/blob/7cdf4c5332e898b2bd1a3190e9ed7ff8ab7a4dca/LICENSE#L496-L673

Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
.github/workflows/test.yml Modify .github/workflows/test.yml with contents:
• Add a new step after the Black code formatting step. This step should run a script that checks if there are any modified files using the git status command.
• If there are modified files, the script should commit these changes with a descriptive commit message.
• The script should then create a new pull request against the main branch using the GitHub CLI or the GitHub API. The title and body of the pull request should clearly indicate that it contains code formatting changes.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

Add PR creation for code formatting changes in test workflow sweep/add-pr-for-code-formatting-changes

Description

This PR modifies the test workflow in order to create a pull request if the code formatter (Black) makes any changes to the files. Currently, the test workflow runs the code formatter but does not automatically submit the changes back to the repository. This can lead to inconsistencies between the code in the repository and the formatted code.

The changes include adding a new step to the workflow that checks if Black has made any modifications. If there are changes, the workflow commits them with a descriptive commit message and creates a new pull request against the main branch. The pull request clearly indicates that it contains code formatting changes.

Summary of Changes

  • Added a new step to the test workflow that checks for code formatting changes made by Black.
  • If changes are detected, the workflow commits them with a descriptive commit message.
  • The workflow then creates a new pull request against the main branch to submit the code formatting changes.
  • The pull request title and body clearly indicate that it contains code formatting changes.

Please review and merge this PR to ensure that code formatting changes are properly submitted back to the repository.


Step 4: ⌨️ Coding

File Instructions Progress Error logs
.github/workflows/test.yml Modify .github/workflows/test.yml with contents:
• Add a new step after the Black code formatting step. This step should run a script that checks if there are any modified files using the git status command.
• If there are modified files, the script should commit these changes with a descriptive commit message.
• The script should then create a new pull request against the main branch using the GitHub CLI or the GitHub API. The title and body of the pull request should clearly indicate that it contains code formatting changes.
✅ Commit 20bcafa No errors. I have finished coding the issue. I am now reviewing it for completeness.

Step 5: 🔁 Code Review

Here are my self-reviews of my changes at sweep/add-pr-for-code-formatting-changes.

Here is the 1st review

No changes required. The modifications made in the .github/workflows/test.yml file correctly implement the functionality to check for changes in the codebase after formatting with black, commit those changes, and create a pull request if there are any changes. Good job!

I finished incorporating these changes.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. Join Our Discord