ultralytics-actions 0.0.11__tar.gz → 0.0.13__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.
Files changed (20) hide show
  1. {ultralytics_actions-0.0.11/ultralytics_actions.egg-info → ultralytics_actions-0.0.13}/PKG-INFO +1 -1
  2. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/__init__.py +1 -1
  3. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/summarize_pr.py +17 -13
  4. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13/ultralytics_actions.egg-info}/PKG-INFO +1 -1
  5. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/LICENSE +0 -0
  6. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/README.md +0 -0
  7. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/first_interaction.py +0 -0
  8. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/summarize_release.py +0 -0
  9. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/update_markdown_code_blocks.py +0 -0
  10. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/utils/__init__.py +0 -0
  11. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/utils/common_utils.py +0 -0
  12. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/utils/github_utils.py +0 -0
  13. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/actions/utils/openai_utils.py +0 -0
  14. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/pyproject.toml +0 -0
  15. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/setup.cfg +0 -0
  16. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/ultralytics_actions.egg-info/SOURCES.txt +0 -0
  17. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
  18. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/ultralytics_actions.egg-info/entry_points.txt +0 -0
  19. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/ultralytics_actions.egg-info/requires.txt +0 -0
  20. {ultralytics_actions-0.0.11 → ultralytics_actions-0.0.13}/ultralytics_actions.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics-actions
3
- Version: 0.0.11
3
+ Version: 0.0.13
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>
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.11"
25
+ __version__ = "0.0.13"
@@ -1,5 +1,7 @@
1
1
  # Ultralytics Actions 🚀, AGPL-3.0 license https://ultralytics.com/license
2
2
 
3
+ import time
4
+
3
5
  import requests
4
6
 
5
7
  from .utils import (
@@ -39,24 +41,26 @@ def generate_pr_summary(repo_name, diff_text):
39
41
  ]
40
42
  reply = get_completion(messages)
41
43
  if len(diff_text) > limit:
42
- return SUMMARY_START + "**WARNING ⚠️** this PR is very large, summary may not cover all changes.\n\n" + reply
43
- else:
44
- return SUMMARY_START + reply
44
+ reply = "**WARNING ⚠️** this PR is very large, summary may not cover all changes.\n\n" + reply
45
+ return reply
45
46
 
46
47
 
47
- def update_pr_description(repo_name, pr_number, new_summary):
48
- """Updates the PR description with a new summary, replacing existing summary if present."""
49
- # Fetch the current PR description
48
+ def update_pr_description(repo_name, pr_number, new_summary, max_retries=2):
49
+ """Updates PR description with new summary, retrying if description is None."""
50
50
  pr_url = f"{GITHUB_API_URL}/repos/{repo_name}/pulls/{pr_number}"
51
- pr_response = requests.get(pr_url, headers=GITHUB_HEADERS)
52
- pr_data = pr_response.json()
53
- current_description = pr_data.get("body") or "" # warning, can be None
51
+ description = ""
52
+ for i in range(max_retries + 1):
53
+ description = requests.get(pr_url, headers=GITHUB_HEADERS).json().get("body") or ""
54
+ if description:
55
+ break
56
+ if i < max_retries:
57
+ print("No current PR description found, retrying...")
58
+ time.sleep(1)
54
59
 
55
60
  # Check if existing summary is present and update accordingly
56
- if SUMMARY_START in current_description:
57
- updated_description = current_description.split(SUMMARY_START)[0] + new_summary
58
- else:
59
- updated_description = current_description + "\n\n" + new_summary
61
+ if SUMMARY_START not in description:
62
+ print(f"No existing summary found in description:\n\n{description}")
63
+ updated_description = description.split(SUMMARY_START)[0] + SUMMARY_START + new_summary
60
64
 
61
65
  # Update the PR description
62
66
  update_response = requests.patch(pr_url, json={"body": updated_description}, headers=GITHUB_HEADERS)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics-actions
3
- Version: 0.0.11
3
+ Version: 0.0.13
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>