SomethingGeneric / flaskpress

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

Add PR creation for code formatting changes in test workflow #11

Closed sweep-ai[bot] closed 1 year ago

sweep-ai[bot] commented 1 year ago

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

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

Fixes #10.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/add-pr-for-code-formatting-changes

🎉 Latest improvements to Sweep:


💡 To get Sweep to edit this pull request, you can:

SomethingGeneric commented 1 year ago

I'm not sure if you can see the output of the merge checks, here's the error they mention:

Run git config --global user.name 'GitHub Action'
[sweep/add-pr-for-code-formatting-changes 874b69c] Apply black formatting
 2 files changed, 40 insertions(+), 23 deletions(-)
gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
  env:
    GH_TOKEN: ${{ github.token }}
Error: Process completed with exit code 4.

Let me know if this involves setting a variable in the repository settings.

sweep-ai[bot] commented 1 year ago

I'm not sure if you can see the output of the merge checks, here's the error they mention:

Run git config --global user.name 'GitHub Action'
[sweep/add-pr-for-code-formatting-changes 874b69c] Apply black formatting
 2 files changed, 40 insertions(+), 23 deletions(-)
gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
  env:
    GH_TOKEN: ${{ github.token }}
Error: Process completed with exit code 4.

Let me know if this involves setting a variable in the repository settings.

Hi @SomethingGeneric,

I decided to make the following changes:

File Path Proposed Changes
.github/workflows/test.yml Modify .github/workflows/test.yml with contents:
• Add the following lines before the "Commit and create PR if changes" step:
```yaml
- name: Set GH_TOKEN
run: echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
```