ultralytics-actions 0.0.84__py3-none-any.whl → 0.0.86__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.84"
25
+ __version__ = "0.0.86"
@@ -25,7 +25,15 @@ def get_prs_between_tags(event, previous_tag: str, latest_tag: str) -> list:
25
25
  url = f"{GITHUB_API_URL}/repos/{event.repository}/compare/{previous_tag}...{latest_tag}"
26
26
  r = event.get(url)
27
27
 
28
+ if r.status_code != 200:
29
+ print(f"Failed to get comparison between {previous_tag} and {latest_tag}, status: {r.status_code}")
30
+ return []
31
+
28
32
  data = r.json()
33
+ if "commits" not in data:
34
+ print(f"No commits found in comparison between {previous_tag} and {latest_tag}")
35
+ return []
36
+
29
37
  pr_numbers = set()
30
38
  for commit in data["commits"]:
31
39
  pr_matches = re.findall(r"#(\d+)", commit["commit"]["message"])
@@ -139,9 +147,9 @@ def create_github_release(event, tag_name: str, name: str, body: str):
139
147
  event.post(url, json=data)
140
148
 
141
149
 
142
- def get_previous_tag() -> str:
143
- """Retrieves the previous Git tag, excluding the current tag, using the git describe command."""
144
- cmd = ["git", "describe", "--tags", "--abbrev=0", "--exclude", CURRENT_TAG]
150
+ def get_actual_previous_tag(current_tag: str) -> str:
151
+ """Gets the actual previous tag using git, excluding the current tag."""
152
+ cmd = ["git", "describe", "--tags", "--abbrev=0", "--exclude", current_tag]
145
153
  try:
146
154
  return subprocess.run(cmd, check=True, text=True, capture_output=True).stdout.strip()
147
155
  except subprocess.CalledProcessError:
@@ -156,7 +164,14 @@ def main(*args, **kwargs):
156
164
  if not all([event.token, CURRENT_TAG]):
157
165
  raise ValueError("One or more required environment variables are missing.")
158
166
 
159
- previous_tag = PREVIOUS_TAG or get_previous_tag()
167
+ # Try PREVIOUS_TAG first, fall back to actual previous tag if comparison fails
168
+ previous_tag = PREVIOUS_TAG or get_actual_previous_tag(CURRENT_TAG)
169
+
170
+ # Test if the previous tag works for comparison
171
+ test_url = f"{GITHUB_API_URL}/repos/{event.repository}/compare/{previous_tag}...{CURRENT_TAG}"
172
+ if event.get(test_url).status_code != 200:
173
+ previous_tag = get_actual_previous_tag(CURRENT_TAG)
174
+ print(f"Using actual previous tag: {previous_tag}")
160
175
 
161
176
  # Get the diff between the tags
162
177
  diff = get_release_diff(event, previous_tag, CURRENT_TAG)
@@ -3,6 +3,7 @@
3
3
  import json
4
4
  import os
5
5
  from pathlib import Path
6
+ from typing import Union
6
7
 
7
8
  import requests
8
9
 
@@ -95,7 +96,7 @@ class Action:
95
96
  """Checks if the repository is public using event data or GitHub API if needed."""
96
97
  return self.event_data.get("repository", {}).get("private")
97
98
 
98
- def get_username(self) -> str | None:
99
+ def get_username(self) -> Union[str, None]:
99
100
  """Gets username associated with the GitHub token."""
100
101
  response = self.post(GITHUB_GRAPHQL_URL, json={"query": "query { viewer { login } }"})
101
102
  if response.status_code == 200:
@@ -7,7 +7,6 @@ import re
7
7
  from pathlib import Path
8
8
 
9
9
  import requests
10
- import tomllib
11
10
 
12
11
 
13
12
  def should_publish(local_version, remote_version):
@@ -26,6 +25,8 @@ def should_publish(local_version, remote_version):
26
25
 
27
26
  def check_pypi_version(pyproject_toml="pyproject.toml"):
28
27
  """Compare local and PyPI package versions to determine if a new version should be published."""
28
+ import tomllib # scope for Python 3.11+
29
+
29
30
  with open(pyproject_toml, "rb") as f:
30
31
  pyproject = tomllib.load(f)
31
32
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.0.84
3
+ Version: 0.0.86
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>
@@ -1,18 +1,18 @@
1
- actions/__init__.py,sha256=Z5WUMTbBJ3h5WEoPBA-lyplNH4NIRfOdyqwegOy3Yi0,742
1
+ actions/__init__.py,sha256=3zS7IZrjILS9WQKAlePlzdxRv5OCERvqYCJtgIeVtR0,742
2
2
  actions/dispatch_actions.py,sha256=vbA4w_B8vMXMen__ck2WoDsUFCELjXOQbpLzZCmqTXg,4240
3
3
  actions/first_interaction.py,sha256=whphdBrWkcWRt6RgOeK2dUoGq3aBTqttQdokxVjkye4,16309
4
4
  actions/summarize_pr.py,sha256=NCaDSbw4PVoRbPJzji_Ua2HadI2pn7QOE_dy3VK9_cc,10463
5
- actions/summarize_release.py,sha256=OncODHx7XsmB-nPf-B1tnxUTcaJx6hM4JAMa9frypzM,7922
5
+ actions/summarize_release.py,sha256=JUGlQ4c5E5Ya_kpYSn-Hs_E1omdFWgsvZLIxOic1qEI,8635
6
6
  actions/update_file_headers.py,sha256=dAu8RWOn-CkuFZHa5LT1-BvNxYX4FRQe2B1UDAjvG3I,6648
7
7
  actions/update_markdown_code_blocks.py,sha256=9PL7YIQfApRNAa0que2hYHv7umGZTZoHlblesB0xFj4,8587
8
8
  actions/utils/__init__.py,sha256=7k4cmFX0Td99Uzgsd8Mm-E0xq5kQ5ZJoPM_oGCVD4CU,804
9
9
  actions/utils/common_utils.py,sha256=2eNwGJFigl9bBXcyWzdr8mr97Lrx7zFKWIFYugZcUJw,11736
10
- actions/utils/github_utils.py,sha256=JQivk6IW2UBeHGx7adIuWjId7D03AWziF6fOfG-Ad6A,8171
10
+ actions/utils/github_utils.py,sha256=wjivM9FPZwaItXpQiYbGbnGdK6v4ayLEFvQT2xhRLq4,8202
11
11
  actions/utils/openai_utils.py,sha256=09kW4K2LOc6KsWz5tijf2Piinhu3PIKPDVkRC3KyIxU,2943
12
- actions/utils/version_utils.py,sha256=oCFPrdzzzkORaT02JAfb9GcPFOIncTU1v_AXAfR8W6I,3157
13
- ultralytics_actions-0.0.84.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
14
- ultralytics_actions-0.0.84.dist-info/METADATA,sha256=3ifMiF4wPn5FGY2OpOdnucXZdE8PUFGZhA2AfXkZZSo,11638
15
- ultralytics_actions-0.0.84.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
16
- ultralytics_actions-0.0.84.dist-info/entry_points.txt,sha256=rvqr6Juj7lCJL1DQLwMmOrA8R2Q8tyR_dvCe0mYuJ8s,441
17
- ultralytics_actions-0.0.84.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
18
- ultralytics_actions-0.0.84.dist-info/RECORD,,
12
+ actions/utils/version_utils.py,sha256=lKY2lLtYdxejKvqD9hFJiARMrYMHnP_KC_zmcLUmD20,3188
13
+ ultralytics_actions-0.0.86.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
14
+ ultralytics_actions-0.0.86.dist-info/METADATA,sha256=Fv6Y8gk0PM6dvUBiqR9IAQyrOVYqFB9sVEmL_m6noNk,11638
15
+ ultralytics_actions-0.0.86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ ultralytics_actions-0.0.86.dist-info/entry_points.txt,sha256=rvqr6Juj7lCJL1DQLwMmOrA8R2Q8tyR_dvCe0mYuJ8s,441
17
+ ultralytics_actions-0.0.86.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
18
+ ultralytics_actions-0.0.86.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5