ultralytics-actions 0.0.54__py3-none-any.whl → 0.0.56__py3-none-any.whl

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.
actions/__init__.py CHANGED
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.54"
25
+ __version__ = "0.0.56"
actions/summarize_pr.py CHANGED
@@ -29,7 +29,7 @@ def generate_merge_message(pr_summary=None, pr_credit=None, pr_url=None):
29
29
  f"Write a warm thank-you comment for the merged PR {pr_url} by {pr_credit}. "
30
30
  f"Context:\n{pr_summary}\n\n"
31
31
  f"Start with an enthusiastic note about the merge, incorporate a relevant inspirational quote from a historical "
32
- f"figure, and connect it to the PRs impact. Keep it concise yet meaningful, ensuring contributors feel valued."
32
+ f"figure, and connect it to the PR's impact. Keep it concise yet meaningful, ensuring contributors feel valued."
33
33
  ),
34
34
  },
35
35
  ]
@@ -44,8 +44,13 @@ def post_merge_message(pr_number, pr_url, repository, summary, pr_credit, header
44
44
  return response.status_code == 201
45
45
 
46
46
 
47
- def generate_issue_comment(pr_url, pr_summary, pr_credit):
48
- """Generates a personalized issue comment using based on the PR context."""
47
+ def generate_issue_comment(pr_url, pr_summary, pr_credit, pr_title=""):
48
+ """Generates personalized issue comment based on PR context."""
49
+ # Extract repo info from PR URL (format: api.github.com/repos/owner/repo/pulls/number)
50
+ repo_parts = pr_url.split("/repos/")[1].split("/pulls/")[0] if "/repos/" in pr_url else ""
51
+ owner_repo = repo_parts.split("/")
52
+ repo_name = owner_repo[-1] if len(owner_repo) > 1 else "package"
53
+
49
54
  messages = [
50
55
  {
51
56
  "role": "system",
@@ -54,13 +59,15 @@ def generate_issue_comment(pr_url, pr_summary, pr_credit):
54
59
  {
55
60
  "role": "user",
56
61
  "content": f"Write a GitHub issue comment announcing a potential fix for this issue is now merged in linked PR {pr_url} by {pr_credit}\n\n"
62
+ f"PR Title: {pr_title}\n\n"
57
63
  f"Context from PR:\n{pr_summary}\n\n"
58
64
  f"Include:\n"
59
65
  f"1. An explanation of key changes from the PR that may resolve this issue\n"
60
66
  f"2. Credit to the PR author and contributors\n"
61
67
  f"3. Options for testing if PR changes have resolved this issue:\n"
62
- f" - pip install git+https://github.com/ultralytics/ultralytics.git@main # test latest changes\n"
63
- f" - or await next official PyPI release\n"
68
+ f" - If the PR mentions a specific version number (like v8.0.0 or 3.1.0), include: pip install -U {repo_name}>=VERSION\n"
69
+ f" - Also suggest: pip install git+https://github.com/{repo_parts}.git@main\n"
70
+ f" - If appropriate, mention they can also wait for the next official PyPI release\n"
64
71
  f"4. Request feedback on whether the PR changes resolve the issue\n"
65
72
  f"5. Thank 🙏 for reporting the issue and welcome any further feedback if the issue persists\n\n",
66
73
  },
@@ -120,13 +127,14 @@ def update_pr_description(pr_url, new_summary, headers, max_retries=2):
120
127
 
121
128
 
122
129
  def label_fixed_issues(repository, pr_number, pr_summary, headers, action):
123
- """Labels issues closed by PR when merged, notifies users, returns PR contributors."""
130
+ """Labels issues closed by PR when merged, notifies users, and returns PR contributors."""
124
131
  query = """
125
132
  query($owner: String!, $repo: String!, $pr_number: Int!) {
126
133
  repository(owner: $owner, name: $repo) {
127
134
  pullRequest(number: $pr_number) {
128
135
  closingIssuesReferences(first: 50) { nodes { number } }
129
136
  url
137
+ title
130
138
  body
131
139
  author { login, __typename }
132
140
  reviews(first: 50) { nodes { author { login, __typename } } }
@@ -143,13 +151,14 @@ query($owner: String!, $repo: String!, $pr_number: Int!) {
143
151
 
144
152
  if response.status_code != 200:
145
153
  print(f"Failed to fetch linked issues. Status code: {response.status_code}")
146
- return [], None
154
+ return None
147
155
 
148
156
  try:
149
157
  data = response.json()["data"]["repository"]["pullRequest"]
150
158
  comments = data["reviews"]["nodes"] + data["comments"]["nodes"]
151
159
  token_username = action.get_username() # get GITHUB_TOKEN username
152
160
  author = data["author"]["login"] if data["author"]["__typename"] != "Bot" else None
161
+ pr_title = data.get("title", "")
153
162
 
154
163
  # Get unique contributors from reviews and comments
155
164
  contributors = {x["author"]["login"] for x in comments if x["author"]["__typename"] != "Bot"}
@@ -173,7 +182,9 @@ query($owner: String!, $repo: String!, $pr_number: Int!) {
173
182
  pr_credit += (" with contributions from " if pr_credit else "") + ", ".join(f"@{c}" for c in contributors)
174
183
 
175
184
  # Generate personalized comment
176
- comment = generate_issue_comment(pr_url=data["url"], pr_summary=pr_summary, pr_credit=pr_credit)
185
+ comment = generate_issue_comment(
186
+ pr_url=data["url"], pr_summary=pr_summary, pr_credit=pr_credit, pr_title=pr_title
187
+ )
177
188
 
178
189
  # Update linked issues
179
190
  for issue in data["closingIssuesReferences"]["nodes"]:
@@ -197,7 +208,7 @@ query($owner: String!, $repo: String!, $pr_number: Int!) {
197
208
  return pr_credit
198
209
  except KeyError as e:
199
210
  print(f"Error parsing GraphQL response: {e}")
200
- return [], None
211
+ return None
201
212
 
202
213
 
203
214
  def remove_todos_on_merge(pr_number, repository, headers):
@@ -158,7 +158,7 @@ def main(root_dir=Path.cwd(), verbose=False):
158
158
  for markdown_file in markdown_files:
159
159
  if verbose:
160
160
  print(f"Processing {markdown_file}")
161
- markdown_content, temp_files = process_markdown_file(markdown_file, temp_dir)
161
+ markdown_content, temp_files = process_markdown_file(markdown_file, temp_dir, verbose)
162
162
  if markdown_content and temp_files:
163
163
  all_temp_files.append((markdown_file, markdown_content, temp_files))
164
164
 
@@ -32,7 +32,7 @@ class Action:
32
32
 
33
33
  @staticmethod
34
34
  def _load_event_data(event_path: str) -> dict:
35
- """Loads GitHub event data from path if it exists."""
35
+ """Load GitHub event data from path if it exists."""
36
36
  if event_path and Path(event_path).exists():
37
37
  return json.loads(Path(event_path).read_text())
38
38
  return {}
@@ -79,7 +79,7 @@ class Action:
79
79
  return result
80
80
 
81
81
  def print_info(self):
82
- """Print GitHub Actions information."""
82
+ """Print GitHub Actions information including event details and repository information."""
83
83
  info = {
84
84
  "github.event_name": self.event_name,
85
85
  "github.event.action": self.event_data.get("action"),
@@ -110,7 +110,7 @@ class Action:
110
110
 
111
111
 
112
112
  def ultralytics_actions_info():
113
- """Returns GitHub Actions environment information and configuration details for Ultralytics workflows."""
113
+ """Return GitHub Actions environment information and configuration details for Ultralytics workflows."""
114
114
  Action().print_info()
115
115
 
116
116
 
@@ -14,11 +14,19 @@ SYSTEM_PROMPT_ADDITION = """
14
14
  Guidance:
15
15
  - Ultralytics Branding: Use YOLO11, YOLO12, etc., not YOLOv11, YOLOv12 (only older versions like YOLOv10 have a v). Always capitalize "HUB" in "Ultralytics HUB"; use "Ultralytics HUB", not "The Ultralytics HUB".
16
16
  - Avoid Equations: Do not include equations or mathematical notations.
17
- - Markdown: Always respond in Markdown.
18
17
  - Tone: Adopt a professional, friendly, and concise tone.
19
18
  """
20
19
 
21
20
 
21
+ def remove_outer_codeblocks(string):
22
+ """Removes outer code block markers and language identifiers from a string while preserving inner content."""
23
+ string = string.strip()
24
+ if string.startswith("```") and string.endswith("```"):
25
+ # Get everything after first ``` and newline, up to the last ```
26
+ string = string[string.find("\n") + 1 : string.rfind("```")].strip()
27
+ return string
28
+
29
+
22
30
  def get_completion(
23
31
  messages: List[Dict[str, str]],
24
32
  check_links: bool = True,
@@ -45,6 +53,7 @@ def get_completion(
45
53
  r = requests.post(url, headers=headers, json=data)
46
54
  r.raise_for_status()
47
55
  content = r.json()["choices"][0]["message"]["content"].strip()
56
+ content = remove_outer_codeblocks(content)
48
57
  for x in remove:
49
58
  content = content.replace(x, "")
50
59
  if not check_links or check_links_in_string(content): # if no checks or checks are passing return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ultralytics-actions
3
- Version: 0.0.54
3
+ Version: 0.0.56
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>
@@ -0,0 +1,15 @@
1
+ actions/__init__.py,sha256=OsA1f_zloRyT6FbnRCGPxd76Cu-N-Vf5WReu9UDlbqY,742
2
+ actions/first_interaction.py,sha256=1_WvQHCi5RWaSfyi49ClF2Zk_3CKGjFnZqz6FlxPRAc,17868
3
+ actions/summarize_pr.py,sha256=BKttOq-MGaanVaChLU5B1ewKUA8K6S05Cy3FQtyRmxU,11681
4
+ actions/summarize_release.py,sha256=tov6qsYGC68lfobvkwVyoWZBGtJ598G0m097n4Ydzvo,8472
5
+ actions/update_markdown_code_blocks.py,sha256=tUChNBIZN-B_unGMG9yQk-dohi7bit02Yl3xc4UtycQ,6610
6
+ actions/utils/__init__.py,sha256=WStdEAYROVnF0nubEOmrFLrejkRiMXIefA5O1ckfcFs,476
7
+ actions/utils/common_utils.py,sha256=PZkK9Wc3od34J9VSw4ICWHhQQC033o3DCrCy0VIyZE4,6024
8
+ actions/utils/github_utils.py,sha256=-F--JgxtXE0fSPMFEzakz7iZilp-vonzLiyXfg0b17Y,7117
9
+ actions/utils/openai_utils.py,sha256=qQbmrJpOUANxSMf7inDSgPIwgf0JHD1fWZuab-y2W6g,2942
10
+ ultralytics_actions-0.0.56.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
+ ultralytics_actions-0.0.56.dist-info/METADATA,sha256=lvqelxqPqg0UiVc-ocGZ6Dy884vQtnjxwlqHqW34AcQ,10561
12
+ ultralytics_actions-0.0.56.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
13
+ ultralytics_actions-0.0.56.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
+ ultralytics_actions-0.0.56.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
+ ultralytics_actions-0.0.56.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- actions/__init__.py,sha256=jdvLrgMZ2Flg6xeVVfi6ayAk9bKCZWgtopdmkyIv8CI,742
2
- actions/first_interaction.py,sha256=1_WvQHCi5RWaSfyi49ClF2Zk_3CKGjFnZqz6FlxPRAc,17868
3
- actions/summarize_pr.py,sha256=WHte6PNJbk_-T8fRDJERs6x3KL4Ah54oH0OH-tsqMUA,11092
4
- actions/summarize_release.py,sha256=tov6qsYGC68lfobvkwVyoWZBGtJ598G0m097n4Ydzvo,8472
5
- actions/update_markdown_code_blocks.py,sha256=ip-KRIfnTMDrs9IOqdSY7YXR4abNLsylGnXtrvoXjwY,6601
6
- actions/utils/__init__.py,sha256=WStdEAYROVnF0nubEOmrFLrejkRiMXIefA5O1ckfcFs,476
7
- actions/utils/common_utils.py,sha256=PZkK9Wc3od34J9VSw4ICWHhQQC033o3DCrCy0VIyZE4,6024
8
- actions/utils/github_utils.py,sha256=0h0Hz2tgUta61Ymn9YggRXBZ7aZdF5krKnX7Tj9jqRU,7068
9
- actions/utils/openai_utils.py,sha256=EQAs1cd-YXXF8xHKLrY3Tsl_AVzgdlXcYOZMYh88_gM,2524
10
- ultralytics_actions-0.0.54.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
- ultralytics_actions-0.0.54.dist-info/METADATA,sha256=4RFFr5-vHZihzjgS_ZklhfTvhO9-TXjmbIDjMxyeYWY,10561
12
- ultralytics_actions-0.0.54.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
13
- ultralytics_actions-0.0.54.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
- ultralytics_actions-0.0.54.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
- ultralytics_actions-0.0.54.dist-info/RECORD,,