ultralytics-actions 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ultralytics-actions might be problematic. Click here for more details.

Files changed (38) hide show
  1. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/PKG-INFO +118 -70
  2. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/README.md +117 -68
  3. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/__init__.py +5 -1
  4. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/first_interaction.py +5 -5
  5. ultralytics_actions-0.2.2/actions/format_python_docstrings.py +511 -0
  6. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/review_pr.py +80 -12
  7. ultralytics_actions-0.2.2/actions/scan_prs.py +233 -0
  8. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/summarize_pr.py +4 -4
  9. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/summarize_release.py +2 -2
  10. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/update_markdown_code_blocks.py +5 -11
  11. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/utils/__init__.py +2 -2
  12. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/utils/openai_utils.py +36 -14
  13. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/pyproject.toml +1 -8
  14. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_first_interaction.py +8 -8
  15. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_init.py +2 -2
  16. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_openai_utils.py +6 -6
  17. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_summarize_pr.py +12 -12
  18. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_summarize_release.py +4 -4
  19. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/ultralytics_actions.egg-info/PKG-INFO +118 -70
  20. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/ultralytics_actions.egg-info/SOURCES.txt +2 -0
  21. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/ultralytics_actions.egg-info/entry_points.txt +1 -0
  22. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/ultralytics_actions.egg-info/requires.txt +0 -1
  23. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/LICENSE +0 -0
  24. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/dispatch_actions.py +0 -0
  25. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/update_file_headers.py +0 -0
  26. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/utils/common_utils.py +0 -0
  27. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/utils/github_utils.py +0 -0
  28. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/actions/utils/version_utils.py +0 -0
  29. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/setup.cfg +0 -0
  30. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_cli_commands.py +0 -0
  31. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_common_utils.py +0 -0
  32. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_dispatch_actions.py +0 -0
  33. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_file_headers.py +0 -0
  34. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_github_utils.py +0 -0
  35. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_update_markdown_codeblocks.py +0 -0
  36. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/tests/test_urls.py +0 -0
  37. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
  38. {ultralytics_actions-0.2.0 → ultralytics_actions-0.2.2}/ultralytics_actions.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Ultralytics Actions for GitHub automation and PR management.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -30,7 +30,6 @@ Description-Content-Type: text/markdown
30
30
  License-File: LICENSE
31
31
  Requires-Dist: requests>=2.28.1
32
32
  Requires-Dist: ruff>=0.9.1
33
- Requires-Dist: docformatter>=1.7.5
34
33
  Provides-Extra: dev
35
34
  Requires-Dist: pytest; extra == "dev"
36
35
  Requires-Dist: pytest-cov; extra == "dev"
@@ -38,111 +37,160 @@ Dynamic: license-file
38
37
 
39
38
  <a href="https://www.ultralytics.com/"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
40
39
 
41
- # 🚀 Ultralytics Actions: AI-powered formatting, labeling & PR summaries for Python and Markdown
40
+ # 🚀 Ultralytics Actions
42
41
 
43
- Welcome to the [Ultralytics Actions](https://github.com/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.
42
+ Welcome to [Ultralytics Actions](https://github.com/ultralytics/actions) - a collection of GitHub Actions and Python tools for automating code quality, PR management, and CI/CD workflows across Ultralytics projects.
44
43
 
45
44
  [![GitHub Actions Marketplace](https://img.shields.io/badge/Marketplace-Ultralytics_Actions-blue?style=flat&logo=github)](https://github.com/marketplace/actions/ultralytics-actions)
46
45
 
47
46
  [![Actions CI](https://github.com/ultralytics/actions/actions/workflows/ci.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/ci.yml)
48
47
  [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml)
49
- [![List Open PRs](https://github.com/ultralytics/actions/actions/workflows/open-prs.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/open-prs.yml)
48
+ [![Scan PRs](https://github.com/ultralytics/actions/actions/workflows/scan-prs.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/scan-prs.yml)
50
49
  [![codecov](https://codecov.io/github/ultralytics/actions/graph/badge.svg?token=DoizJ1WS6j)](https://codecov.io/github/ultralytics/actions)
51
50
 
52
51
  [![Ultralytics Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://discord.com/invite/ultralytics)
53
52
  [![Ultralytics Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com/)
54
53
  [![Ultralytics Reddit](https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue)](https://reddit.com/r/ultralytics)
55
54
 
56
- ## 📄 Actions Description
57
-
58
- Ultralytics Actions automatically applies formats, updates, and enhancements using a suite of powerful tools:
59
-
60
- - **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter.
61
- - **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance.
62
- - **Docstrings:** Cleaned and standardized using [docformatter](https://github.com/PyCQA/docformatter).
63
- - **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) to maintain a uniform coding style across Swift projects. _(Note: Requires the `macos-latest` runner.)_
64
- - **Spell Check:** Common misspellings are caught using [codespell](https://github.com/codespell-project/codespell).
65
- - **Broken Links Check:** Broken links in documentation and Markdown files are identified using [Lychee](https://github.com/lycheeverse/lychee).
66
- - **PR Summary:** Concise Pull Request summaries are generated using [OpenAI](https://openai.com/) GPT-5, improving clarity and review efficiency.
67
- - **PR Review:** AI-powered code reviews identify critical bugs, security issues, and code quality concerns with suggested fixes.
68
- - **Auto-labeling:** Applies relevant labels to issues and PRs via [OpenAI](https://openai.com/) GPT-5 for intelligent categorization.
69
-
70
- ## 🛠️ How It Works
55
+ ## 📦 Repository Contents
56
+
57
+ This repository provides three main components:
58
+
59
+ 1. **[Ultralytics Actions](#ultralytics-actions-main-action)** - Main GitHub Action for AI-powered code formatting, PR summaries, and auto-labeling
60
+ 2. **[Standalone Actions](#standalone-actions)** - Reusable composite actions for common CI/CD tasks
61
+ 3. **[Python Package](#python-package)** - `ultralytics-actions` package for programmatic use
62
+
63
+ ## Ultralytics Actions (Main Action)
64
+
65
+ AI-powered formatting, labeling, and PR summaries for Python, Swift, and Markdown files.
66
+
67
+ ### 📄 Features
68
+
69
+ - **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter
70
+ - **Python Docstrings:** Google-style formatting enforced with Ultralytics Python docstring formatter (optional)
71
+ - **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance
72
+ - **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) _(requires `macos-latest` runner)_
73
+ - **Spell Check:** Common misspellings caught using [codespell](https://github.com/codespell-project/codespell)
74
+ - **Broken Links Check:** Broken links identified using [Lychee](https://github.com/lycheeverse/lychee)
75
+ - **PR Summary:** Concise Pull Request summaries generated using [OpenAI](https://openai.com/) GPT-5
76
+ - **PR Review:** AI-powered code reviews identify critical bugs, security issues, and quality concerns with suggested fixes
77
+ - **Auto-labeling:** Applies relevant labels to issues and PRs via [OpenAI](https://openai.com/) GPT-5
78
+
79
+ ### 🛠️ How It Works
80
+
81
+ Triggers on GitHub events to streamline workflows:
82
+
83
+ - **Push Events:** Automatically formats code when changes are pushed to `main`
84
+ - **Pull Requests:** Ensures formatting standards, generates summaries, provides AI reviews, and applies labels
85
+ - **Issues:** Automatically applies relevant labels using GPT-5
86
+
87
+ ### 🔧 Setup
88
+
89
+ Create `.github/workflows/ultralytics-actions.yml`:
90
+
91
+ ```yaml
92
+ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
93
+
94
+ # Ultralytics Actions https://github.com/ultralytics/actions
95
+ # This workflow formats code and documentation in PRs to Ultralytics standards
96
+
97
+ name: Ultralytics Actions
98
+
99
+ on:
100
+ issues:
101
+ types: [opened]
102
+ pull_request:
103
+ branches: [main]
104
+ types: [opened, closed, synchronize, review_requested]
105
+
106
+ permissions:
107
+ contents: write # Modify code in PRs
108
+ pull-requests: write # Add comments and labels to PRs
109
+ issues: write # Add comments and labels to issues
110
+
111
+ jobs:
112
+ actions:
113
+ runs-on: ubuntu-latest
114
+ steps:
115
+ - name: Run Ultralytics Actions
116
+ uses: ultralytics/actions@main
117
+ with:
118
+ token: ${{ secrets.GITHUB_TOKEN }} # Auto-generated token
119
+ labels: true # Auto-label issues/PRs using AI
120
+ python: true # Format Python with Ruff
121
+ python_docstrings: false # Format Python docstrings (default: false)
122
+ prettier: true # Format YAML, JSON, Markdown, CSS
123
+ swift: false # Format Swift (requires macos-latest)
124
+ dart: false # Format Dart/Flutter
125
+ spelling: true # Check spelling with codespell
126
+ links: true # Check broken links with Lychee
127
+ summary: true # Generate AI-powered PR summaries
128
+ openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Powers PR summaries, labels and reviews
129
+ brave_api_key: ${{ secrets.BRAVE_API_KEY }} # Used for broken link resolution
130
+ ```
71
131
 
72
- Ultralytics Actions triggers on various GitHub events to streamline workflows:
132
+ ## Standalone Actions
73
133
 
74
- - **Push Events:** Automatically formats code when changes are pushed to the `main` branch.
75
- - **Pull Requests:**
76
- - Ensures contributions meet formatting standards before merging.
77
- - Generates a concise summary of changes using GPT-5.
78
- - Provides AI-powered inline code reviews with suggested fixes for critical issues.
79
- - Applies relevant labels using GPT-5 for intelligent categorization.
80
- - **Issues:** Automatically applies relevant labels using GPT-5 when new issues are created.
134
+ Reusable composite actions for common CI/CD tasks. Each can be used independently in your workflows.
81
135
 
82
- 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.
136
+ ### 1. Retry Action
83
137
 
84
- ## 🔧 Setting Up the Action
138
+ Retry failed commands with exponential backoff.
85
139
 
86
- To integrate this action into your Ultralytics repository:
140
+ ```yaml
141
+ - uses: ultralytics/actions/retry@main
142
+ with:
143
+ command: npm install
144
+ max_attempts: 3
145
+ timeout_minutes: 5
146
+ ```
87
147
 
88
- 1. **Create a Workflow File:** In your repository, create a YAML file under `.github/workflows/`, for example, `ultralytics-actions.yml`.
148
+ [**📖 Full Documentation →**](retry/README.md)
89
149
 
90
- 2. **Add the Action:** Configure the Ultralytics Actions in your workflow file as shown below:
150
+ ### 2. Cleanup Disk Action
91
151
 
92
- ```yaml
93
- # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
152
+ Free up disk space on GitHub runners by removing unnecessary packages and files.
94
153
 
95
- # Ultralytics Actions https://github.com/ultralytics/actions
96
- # This workflow formats code and documentation in PRs to Ultralytics standards
154
+ ```yaml
155
+ - uses: ultralytics/actions/cleanup-disk@main
156
+ ```
97
157
 
98
- name: Ultralytics Actions
158
+ [**📖 Full Documentation →**](cleanup-disk/README.md)
99
159
 
100
- on:
101
- issues:
102
- types: [opened]
103
- pull_request:
104
- branches: [main]
105
- types: [opened, closed, synchronize, review_requested]
160
+ ### 3. Scan PRs Action
106
161
 
107
- permissions:
108
- contents: write # Modify code in PRs
109
- pull-requests: write # Add comments and labels to PRs
110
- issues: write # Add comments and labels to issues
162
+ List open PRs across an organization and auto-merge eligible Dependabot PRs.
111
163
 
112
- jobs:
113
- actions:
114
- runs-on: ubuntu-latest
115
- steps:
116
- - name: Run Ultralytics Actions
117
- uses: ultralytics/actions@main
118
- with:
119
- token: ${{ secrets.GITHUB_TOKEN }} # Auto-generated token
120
- labels: true # Auto-label issues/PRs using AI
121
- python: true # Format Python with Ruff and docformatter
122
- prettier: true # Format YAML, JSON, Markdown, CSS
123
- swift: false # Format Swift (requires macos-latest)
124
- dart: false # Format Dart/Flutter
125
- spelling: true # Check spelling with codespell
126
- links: true # Check broken links with Lychee
127
- summary: true # Generate AI-powered PR summaries
128
- openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Powers PR summaries, labels and comments
129
- brave_api_key: ${{ secrets.BRAVE_API_KEY }} # Used for broken link resolution
130
- ```
164
+ ```yaml
165
+ - uses: ultralytics/actions/scan-prs@main
166
+ with:
167
+ token: ${{ secrets.GITHUB_TOKEN }}
168
+ org: ultralytics # Optional: defaults to ultralytics
169
+ visibility: private,internal # Optional: public, private, internal, all, or comma-separated
170
+ ```
131
171
 
132
- 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`.
172
+ [**📖 Full Documentation →**](scan-prs/README.md)
133
173
 
134
174
  ## Python Package
135
175
 
136
- Install the `ultralytics-actions` Python package directly with Pip:
176
+ Install `ultralytics-actions` for programmatic access to action utilities.
137
177
 
138
178
  [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics-actions?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics-actions/)
139
179
  [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://clickpy.clickhouse.com/dashboard/ultralytics-actions)
140
180
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics-actions?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics-actions/)
141
181
 
142
- ```sh
182
+ ```bash
143
183
  pip install ultralytics-actions
144
184
  ```
145
185
 
186
+ **Available Modules:**
187
+
188
+ - `actions.review_pr` - AI-powered PR review
189
+ - `actions.summarize_pr` - Generate PR summaries
190
+ - `actions.scan_prs` - Scan and manage organization PRs
191
+ - `actions.first_interaction` - Welcome message for new contributors
192
+ - And more in `actions/` directory
193
+
146
194
  ## 💡 Contribute
147
195
 
148
196
  Ultralytics thrives on community collaboration, and we deeply value your contributions! Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) for details on how you can get involved. We also encourage you to share your feedback through our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A huge thank you 🙏 to all our contributors!
@@ -1,110 +1,159 @@
1
1
  <a href="https://www.ultralytics.com/"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
2
2
 
3
- # 🚀 Ultralytics Actions: AI-powered formatting, labeling & PR summaries for Python and Markdown
3
+ # 🚀 Ultralytics Actions
4
4
 
5
- Welcome to the [Ultralytics Actions](https://github.com/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.
5
+ Welcome to [Ultralytics Actions](https://github.com/ultralytics/actions) - a collection of GitHub Actions and Python tools for automating code quality, PR management, and CI/CD workflows across Ultralytics projects.
6
6
 
7
7
  [![GitHub Actions Marketplace](https://img.shields.io/badge/Marketplace-Ultralytics_Actions-blue?style=flat&logo=github)](https://github.com/marketplace/actions/ultralytics-actions)
8
8
 
9
9
  [![Actions CI](https://github.com/ultralytics/actions/actions/workflows/ci.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/ci.yml)
10
10
  [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml)
11
- [![List Open PRs](https://github.com/ultralytics/actions/actions/workflows/open-prs.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/open-prs.yml)
11
+ [![Scan PRs](https://github.com/ultralytics/actions/actions/workflows/scan-prs.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/scan-prs.yml)
12
12
  [![codecov](https://codecov.io/github/ultralytics/actions/graph/badge.svg?token=DoizJ1WS6j)](https://codecov.io/github/ultralytics/actions)
13
13
 
14
14
  [![Ultralytics Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://discord.com/invite/ultralytics)
15
15
  [![Ultralytics Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com/)
16
16
  [![Ultralytics Reddit](https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue)](https://reddit.com/r/ultralytics)
17
17
 
18
- ## 📄 Actions Description
19
-
20
- Ultralytics Actions automatically applies formats, updates, and enhancements using a suite of powerful tools:
21
-
22
- - **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter.
23
- - **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance.
24
- - **Docstrings:** Cleaned and standardized using [docformatter](https://github.com/PyCQA/docformatter).
25
- - **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) to maintain a uniform coding style across Swift projects. _(Note: Requires the `macos-latest` runner.)_
26
- - **Spell Check:** Common misspellings are caught using [codespell](https://github.com/codespell-project/codespell).
27
- - **Broken Links Check:** Broken links in documentation and Markdown files are identified using [Lychee](https://github.com/lycheeverse/lychee).
28
- - **PR Summary:** Concise Pull Request summaries are generated using [OpenAI](https://openai.com/) GPT-5, improving clarity and review efficiency.
29
- - **PR Review:** AI-powered code reviews identify critical bugs, security issues, and code quality concerns with suggested fixes.
30
- - **Auto-labeling:** Applies relevant labels to issues and PRs via [OpenAI](https://openai.com/) GPT-5 for intelligent categorization.
31
-
32
- ## 🛠️ How It Works
18
+ ## 📦 Repository Contents
19
+
20
+ This repository provides three main components:
21
+
22
+ 1. **[Ultralytics Actions](#ultralytics-actions-main-action)** - Main GitHub Action for AI-powered code formatting, PR summaries, and auto-labeling
23
+ 2. **[Standalone Actions](#standalone-actions)** - Reusable composite actions for common CI/CD tasks
24
+ 3. **[Python Package](#python-package)** - `ultralytics-actions` package for programmatic use
25
+
26
+ ## Ultralytics Actions (Main Action)
27
+
28
+ AI-powered formatting, labeling, and PR summaries for Python, Swift, and Markdown files.
29
+
30
+ ### 📄 Features
31
+
32
+ - **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter
33
+ - **Python Docstrings:** Google-style formatting enforced with Ultralytics Python docstring formatter (optional)
34
+ - **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance
35
+ - **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) _(requires `macos-latest` runner)_
36
+ - **Spell Check:** Common misspellings caught using [codespell](https://github.com/codespell-project/codespell)
37
+ - **Broken Links Check:** Broken links identified using [Lychee](https://github.com/lycheeverse/lychee)
38
+ - **PR Summary:** Concise Pull Request summaries generated using [OpenAI](https://openai.com/) GPT-5
39
+ - **PR Review:** AI-powered code reviews identify critical bugs, security issues, and quality concerns with suggested fixes
40
+ - **Auto-labeling:** Applies relevant labels to issues and PRs via [OpenAI](https://openai.com/) GPT-5
41
+
42
+ ### 🛠️ How It Works
43
+
44
+ Triggers on GitHub events to streamline workflows:
45
+
46
+ - **Push Events:** Automatically formats code when changes are pushed to `main`
47
+ - **Pull Requests:** Ensures formatting standards, generates summaries, provides AI reviews, and applies labels
48
+ - **Issues:** Automatically applies relevant labels using GPT-5
49
+
50
+ ### 🔧 Setup
51
+
52
+ Create `.github/workflows/ultralytics-actions.yml`:
53
+
54
+ ```yaml
55
+ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
56
+
57
+ # Ultralytics Actions https://github.com/ultralytics/actions
58
+ # This workflow formats code and documentation in PRs to Ultralytics standards
59
+
60
+ name: Ultralytics Actions
61
+
62
+ on:
63
+ issues:
64
+ types: [opened]
65
+ pull_request:
66
+ branches: [main]
67
+ types: [opened, closed, synchronize, review_requested]
68
+
69
+ permissions:
70
+ contents: write # Modify code in PRs
71
+ pull-requests: write # Add comments and labels to PRs
72
+ issues: write # Add comments and labels to issues
73
+
74
+ jobs:
75
+ actions:
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - name: Run Ultralytics Actions
79
+ uses: ultralytics/actions@main
80
+ with:
81
+ token: ${{ secrets.GITHUB_TOKEN }} # Auto-generated token
82
+ labels: true # Auto-label issues/PRs using AI
83
+ python: true # Format Python with Ruff
84
+ python_docstrings: false # Format Python docstrings (default: false)
85
+ prettier: true # Format YAML, JSON, Markdown, CSS
86
+ swift: false # Format Swift (requires macos-latest)
87
+ dart: false # Format Dart/Flutter
88
+ spelling: true # Check spelling with codespell
89
+ links: true # Check broken links with Lychee
90
+ summary: true # Generate AI-powered PR summaries
91
+ openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Powers PR summaries, labels and reviews
92
+ brave_api_key: ${{ secrets.BRAVE_API_KEY }} # Used for broken link resolution
93
+ ```
33
94
 
34
- Ultralytics Actions triggers on various GitHub events to streamline workflows:
95
+ ## Standalone Actions
35
96
 
36
- - **Push Events:** Automatically formats code when changes are pushed to the `main` branch.
37
- - **Pull Requests:**
38
- - Ensures contributions meet formatting standards before merging.
39
- - Generates a concise summary of changes using GPT-5.
40
- - Provides AI-powered inline code reviews with suggested fixes for critical issues.
41
- - Applies relevant labels using GPT-5 for intelligent categorization.
42
- - **Issues:** Automatically applies relevant labels using GPT-5 when new issues are created.
97
+ Reusable composite actions for common CI/CD tasks. Each can be used independently in your workflows.
43
98
 
44
- 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.
99
+ ### 1. Retry Action
45
100
 
46
- ## 🔧 Setting Up the Action
101
+ Retry failed commands with exponential backoff.
47
102
 
48
- To integrate this action into your Ultralytics repository:
103
+ ```yaml
104
+ - uses: ultralytics/actions/retry@main
105
+ with:
106
+ command: npm install
107
+ max_attempts: 3
108
+ timeout_minutes: 5
109
+ ```
49
110
 
50
- 1. **Create a Workflow File:** In your repository, create a YAML file under `.github/workflows/`, for example, `ultralytics-actions.yml`.
111
+ [**📖 Full Documentation →**](retry/README.md)
51
112
 
52
- 2. **Add the Action:** Configure the Ultralytics Actions in your workflow file as shown below:
113
+ ### 2. Cleanup Disk Action
53
114
 
54
- ```yaml
55
- # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
115
+ Free up disk space on GitHub runners by removing unnecessary packages and files.
56
116
 
57
- # Ultralytics Actions https://github.com/ultralytics/actions
58
- # This workflow formats code and documentation in PRs to Ultralytics standards
117
+ ```yaml
118
+ - uses: ultralytics/actions/cleanup-disk@main
119
+ ```
59
120
 
60
- name: Ultralytics Actions
121
+ [**📖 Full Documentation →**](cleanup-disk/README.md)
61
122
 
62
- on:
63
- issues:
64
- types: [opened]
65
- pull_request:
66
- branches: [main]
67
- types: [opened, closed, synchronize, review_requested]
123
+ ### 3. Scan PRs Action
68
124
 
69
- permissions:
70
- contents: write # Modify code in PRs
71
- pull-requests: write # Add comments and labels to PRs
72
- issues: write # Add comments and labels to issues
125
+ List open PRs across an organization and auto-merge eligible Dependabot PRs.
73
126
 
74
- jobs:
75
- actions:
76
- runs-on: ubuntu-latest
77
- steps:
78
- - name: Run Ultralytics Actions
79
- uses: ultralytics/actions@main
80
- with:
81
- token: ${{ secrets.GITHUB_TOKEN }} # Auto-generated token
82
- labels: true # Auto-label issues/PRs using AI
83
- python: true # Format Python with Ruff and docformatter
84
- prettier: true # Format YAML, JSON, Markdown, CSS
85
- swift: false # Format Swift (requires macos-latest)
86
- dart: false # Format Dart/Flutter
87
- spelling: true # Check spelling with codespell
88
- links: true # Check broken links with Lychee
89
- summary: true # Generate AI-powered PR summaries
90
- openai_api_key: ${{ secrets.OPENAI_API_KEY }} # Powers PR summaries, labels and comments
91
- brave_api_key: ${{ secrets.BRAVE_API_KEY }} # Used for broken link resolution
92
- ```
127
+ ```yaml
128
+ - uses: ultralytics/actions/scan-prs@main
129
+ with:
130
+ token: ${{ secrets.GITHUB_TOKEN }}
131
+ org: ultralytics # Optional: defaults to ultralytics
132
+ visibility: private,internal # Optional: public, private, internal, all, or comma-separated
133
+ ```
93
134
 
94
- 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`.
135
+ [**📖 Full Documentation →**](scan-prs/README.md)
95
136
 
96
137
  ## Python Package
97
138
 
98
- Install the `ultralytics-actions` Python package directly with Pip:
139
+ Install `ultralytics-actions` for programmatic access to action utilities.
99
140
 
100
141
  [![PyPI - Version](https://img.shields.io/pypi/v/ultralytics-actions?logo=pypi&logoColor=white)](https://pypi.org/project/ultralytics-actions/)
101
142
  [![Ultralytics Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://clickpy.clickhouse.com/dashboard/ultralytics-actions)
102
143
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ultralytics-actions?logo=python&logoColor=gold)](https://pypi.org/project/ultralytics-actions/)
103
144
 
104
- ```sh
145
+ ```bash
105
146
  pip install ultralytics-actions
106
147
  ```
107
148
 
149
+ **Available Modules:**
150
+
151
+ - `actions.review_pr` - AI-powered PR review
152
+ - `actions.summarize_pr` - Generate PR summaries
153
+ - `actions.scan_prs` - Scan and manage organization PRs
154
+ - `actions.first_interaction` - Welcome message for new contributors
155
+ - And more in `actions/` directory
156
+
108
157
  ## 💡 Contribute
109
158
 
110
159
  Ultralytics thrives on community collaboration, and we deeply value your contributions! Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) for details on how you can get involved. We also encourage you to share your feedback through our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A huge thank you 🙏 to all our contributors!
@@ -12,10 +12,14 @@
12
12
  # │ │ ├── github_utils.py
13
13
  # │ │ ├── openai_utils.py
14
14
  # │ │ └── common_utils.py
15
+ # │ ├── dispatch_actions.py
15
16
  # │ ├── first_interaction.py
16
17
  # │ ├── review_pr.py
18
+ # │ ├── scan_prs.py
17
19
  # │ ├── summarize_pr.py
18
20
  # │ ├── summarize_release.py
21
+ # │ ├── format_python_docstrings.py
22
+ # │ ├── update_file_headers.py
19
23
  # │ └── update_markdown_code_blocks.py
20
24
  # └── tests/
21
25
  # ├── __init__.py
@@ -23,4 +27,4 @@
23
27
  # ├── test_summarize_pr.py
24
28
  # └── ...
25
29
 
26
- __version__ = "0.2.0"
30
+ __version__ = "0.2.2"
@@ -7,7 +7,7 @@ import time
7
7
 
8
8
  from . import review_pr
9
9
  from .summarize_pr import SUMMARY_MARKER
10
- from .utils import ACTIONS_CREDIT, Action, filter_labels, get_completion, get_pr_open_response, remove_html_comments
10
+ from .utils import ACTIONS_CREDIT, Action, filter_labels, get_pr_open_response, get_response, remove_html_comments
11
11
 
12
12
  BLOCK_USER = os.getenv("BLOCK_USER", "false").lower() == "true"
13
13
  AUTO_PR_REVIEW = os.getenv("REVIEW", "true").lower() == "true"
@@ -91,7 +91,7 @@ YOUR RESPONSE (label names only):
91
91
  },
92
92
  {"role": "user", "content": prompt},
93
93
  ]
94
- suggested_labels = get_completion(messages, temperature=1.0)
94
+ suggested_labels = get_response(messages, temperature=1.0)
95
95
  if "none" in suggested_labels.lower():
96
96
  return []
97
97
 
@@ -170,7 +170,7 @@ YOUR {issue_type.upper()} RESPONSE:
170
170
  },
171
171
  {"role": "user", "content": prompt},
172
172
  ]
173
- return get_completion(messages)
173
+ return get_response(messages)
174
174
 
175
175
 
176
176
  def main(*args, **kwargs):
@@ -188,9 +188,9 @@ def main(*args, **kwargs):
188
188
  if event.should_skip_pr_author():
189
189
  return
190
190
 
191
- print("Processing PR open with unified API call...")
191
+ print(f"Processing PR open by @{username} with unified API call...")
192
192
  diff = event.get_pr_diff()
193
- response = get_pr_open_response(event.repository, diff, title, body, label_descriptions)
193
+ response = get_pr_open_response(event.repository, diff, title, username, label_descriptions)
194
194
 
195
195
  if summary := response.get("summary"):
196
196
  print("Updating PR description with summary...")