Skip to content

ultralytics/actions

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Ultralytics logo

πŸš€ Ultralytics Actions: Auto-Formatting for Python, Markdown, and Swift

Welcome to the Ultralytics Actions repository, your go-to solution for maintaining consistent code quality across Ultralytics Python and Swift projects. This GitHub Action is designed to automate the formatting of Python, Markdown, and Swift files, ensuring adherence to our coding standards and enhancing project maintainability.

GitHub Actions Marketplace Ultralytics Actions Ultralytics Discord Ultralytics Forums Ultralytics Reddit PyPI version Downloads

πŸ“„ Actions Description

Ultralytics Actions automatically applies formats, updates, and enhancements using a suite of powerful tools:

  • Python Code: Formatted using Ruff, an extremely fast Python linter and formatter.
  • Markdown Files: Styled with Prettier to ensure consistent documentation appearance.
  • Docstrings: Cleaned and standardized using docformatter.
  • Swift Code: Formatted with swift-format to maintain a uniform coding style across Swift projects. (Note: Requires the macos-latest runner.)
  • Spell Check: Common misspellings are caught using codespell.
  • Broken Links Check: Broken links in documentation and Markdown files are identified using Lychee.
  • PR Summary: Concise Pull Request summaries are generated using OpenAI GPT-4.1, improving clarity and review efficiency.
  • Auto-labeling: Relevant labels are applied to issues and pull requests via OpenAI GPT-4.1 for intelligent categorization.

πŸ› οΈ How It Works

Ultralytics Actions triggers on various GitHub events to streamline workflows:

  • Push Events: Automatically formats code when changes are pushed to the main branch.
  • Pull Requests:
    • Ensures contributions meet formatting standards before merging.
    • Generates a concise summary of changes using GPT-4.1.
    • Applies relevant labels using GPT-4.1 for intelligent categorization.
  • Issues: Automatically applies relevant labels using GPT-4.1 when new issues are created.

These automated actions help maintain high code quality, improve documentation clarity, and streamline the review process by providing consistent formatting, informative summaries, and appropriate categorization.

πŸ”§ Setting Up the Action

To integrate this action into your Ultralytics repository:

  1. Create a Workflow File: In your repository, create a YAML file under .github/workflows/, for example, ultralytics-actions.yml.

  2. Add the Action: Configure the Ultralytics Actions in your workflow file as shown below:

    name: Ultralytics Actions
    
    on:
      issues:
        types: [opened]
      pull_request:
        branches: [main]
        types: [opened, closed]
    
    jobs:
      format:
        runs-on: ubuntu-latest # Use 'macos-latest' if 'swift: true'
        steps:
          - name: Run Ultralytics Formatting
            uses: ultralytics/actions@main
            with:
              token: ${{ secrets.GITHUB_TOKEN }} # Automatically generated, do not modify
              labels: true # Autolabel issues and PRs using GPT-4.1 (requires 'openai_api_key')
              python: true # Format Python code and docstrings with Ruff and docformatter
              prettier: true # Format YAML, JSON, Markdown, and CSS with Prettier
              swift: false # Format Swift code with swift-format (requires 'runs-on: macos-latest')
              spelling: true # Check spelling with codespell
              links: true # Check for broken links with Lychee
              summary: true # Generate PR summary with GPT-4.1 (requires 'openai_api_key')
              openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Add your OpenAI API key as a repository secret
  3. Customize: Adjust the runs-on runner and the boolean flags (labels, python, prettier, swift, spelling, links, summary) based on your project's needs. Remember to add your OPENAI_API_KEY as a secret in your repository settings if you enable labels or summary.

πŸ’‘ Contribute

Ultralytics thrives on community collaboration, and we deeply value your contributions! Please see our Contributing Guide for details on how you can get involved. We also encourage you to share your feedback through our Survey. A huge thank you πŸ™ to all our contributors!

Ultralytics open-source contributors

πŸ“„ License

Ultralytics offers two licensing options:

  • AGPL-3.0 License: An OSI-approved open-source license ideal for students, researchers, and enthusiasts who value open collaboration. See the LICENSE file for details.
  • Enterprise License: Designed for commercial use, this license allows integrating Ultralytics software and AI models into commercial products without AGPL-3.0's open-source requirements. For enterprise solutions, contact Ultralytics Licensing.

πŸ“« Contact

For bug reports or feature suggestions related to Ultralytics Actions, please submit an issue via GitHub Issues. Join our Discord community for discussions and support!


Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics BiliBili space Ultralytics Discord