Skip to content

dx(platform): Add format-on-command workflow #10037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented May 25, 2025

Changes

  • add workflow that runs backend and frontend formatters when a PR comment !format is added by the author or a maintainer

Checklist

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan

@Pwuts Pwuts requested a review from a team as a code owner May 25, 2025 18:08
@Pwuts Pwuts added the codex label May 25, 2025 — with ChatGPT Connector
@github-project-automation github-project-automation bot moved this to 🆕 Needs initial review in AutoGPT development kanban May 25, 2025
Copy link

netlify bot commented May 25, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit 1b016cc
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/683360da8bae2700082c53d7

@github-actions github-actions bot added the platform/backend AutoGPT Platform - Back end label May 25, 2025
Copy link

deepsource-io bot commented May 25, 2025

Here's the code health analysis summary for commits 767d2f2..1b016cc. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

netlify bot commented May 25, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 1b016cc
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/683360daa6aa850008947796

@Pwuts Pwuts changed the title Add format-on-command workflow ci: Add format-on-command workflow May 25, 2025
@Pwuts Pwuts changed the title ci: Add format-on-command workflow dx(platform): Add format-on-command workflow May 25, 2025
@AutoGPT-Agent
Copy link

Thank you for submitting this PR to add a format-on-command workflow! A few things need to be addressed before we can merge:

  1. Please update the PR title to follow our conventional commit format. Since this is a CI improvement, something like ci: add format-on-command workflow would be appropriate.

  2. The checklist is incomplete. Please add a test plan that explains how you've verified this workflow functions correctly. For a workflow like this, the test plan might include:

    • How you tested the workflow triggers correctly on the !format comment
    • How you verified the formatting runs as expected
    • Any limitations or edge cases to be aware of

This is a useful addition that will help streamline our development process, so I'm looking forward to seeing these adjustments!

@AutoGPT-Agent
Copy link

Thank you for adding this format-on-command workflow! This will be a great addition to improve the developer experience when working with the platform codebase.

However, before we can merge this PR, please complete the checklist in the PR description. Specifically:

  1. You need to add a test plan describing how you've verified this workflow functions correctly
  2. Check off that you've tested according to the test plan

Since this is a GitHub workflow, your test plan might involve:

  • Testing the workflow on a test PR by adding the '!format' comment
  • Verifying the workflow runs as expected and correctly formats code
  • Checking permissions are appropriate

Please update the PR description with these details so we can proceed with the review.

@AutoGPT-Agent
Copy link

Thanks for adding this format-on-command workflow! This will be helpful for streamlining the PR process.

Before we can merge this, please complete the checklist by:

  1. Adding a test plan for how you would verify this workflow works correctly
  2. Confirming that you've tested according to that plan

A test plan for this type of workflow might include:

  • Creating a test PR with some intentionally unformatted code
  • Adding a '!format' comment to verify the workflow triggers
  • Checking that the workflow successfully formats the code
  • Verifying the workflow only triggers for authorized users

Since this workflow will be modifying code automatically on PRs, we want to make sure it's thoroughly tested before merging.

@AutoGPT-Agent
Copy link

Thanks for adding this useful developer experience improvement! The workflow for formatting on command will be a great addition to streamline code quality maintenance.

A couple of items need to be addressed before this can be merged:

  1. Please complete the checklist in your PR description. Specifically:
    • Add a test plan that describes how you'll verify this workflow works correctly
    • Check off that you've tested according to this plan

Since this workflow runs on PR comments and modifies code, a test plan is particularly important to ensure it works as expected and doesn't cause any issues.

Your implementation looks solid overall - I like how it checks if the commenter is the PR author or a maintainer before running the formatters.

Comment on lines +39 to +43
- name: Checkout PR source
uses: actions/checkout@v4
with:
repository: ${{ steps.pr.outputs.head_repo }}
ref: ${{ steps.pr.outputs.head_ref }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntindle @Bentlybro is this dangerous to do in a workflow with repo write permissions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes in my opinion I’d say this is potentially dangerous, mainly due to the direct commit and push to user-controlled branches.

Maybe there is a better way we can do this with a github bot instead of a cl action? or something else.

@Pwuts Pwuts marked this pull request as draft May 25, 2025 18:32
@Pwuts Pwuts added DX and removed platform/backend AutoGPT Platform - Back end labels Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 Needs initial review
Development

Successfully merging this pull request may close these issues.

3 participants