ultralytics-actions 0.0.15__tar.gz → 0.0.25__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.15/ultralytics_actions.egg-info → ultralytics_actions-0.0.25}/PKG-INFO +3 -2
  2. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/README.md +1 -1
  3. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/__init__.py +1 -1
  4. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/summarize_pr.py +46 -1
  5. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/utils/github_utils.py +9 -3
  6. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/utils/openai_utils.py +1 -1
  7. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/pyproject.toml +1 -0
  8. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25/ultralytics_actions.egg-info}/PKG-INFO +3 -2
  9. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/LICENSE +0 -0
  10. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/first_interaction.py +0 -0
  11. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/summarize_release.py +0 -0
  12. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/update_markdown_code_blocks.py +0 -0
  13. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/utils/__init__.py +0 -0
  14. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/actions/utils/common_utils.py +0 -0
  15. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/setup.cfg +0 -0
  16. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/SOURCES.txt +0 -0
  17. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
  18. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/entry_points.txt +0 -0
  19. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/requires.txt +0 -0
  20. {ultralytics_actions-0.0.15 → ultralytics_actions-0.0.25}/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.15
3
+ Version: 0.0.25
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>
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Topic :: Software Development
24
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
26
  Classifier: Topic :: Internet :: WWW/HTTP
@@ -42,7 +43,7 @@ Welcome to the [Ultralytics Actions](https://github.com/ultralytics/actions) rep
42
43
 
43
44
  [![GitHub Actions Marketplace](https://img.shields.io/badge/Marketplace-Ultralytics_Actions-blue?style=flat&logo=github)](https://github.com/marketplace/actions/ultralytics-actions) [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml) <a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://reddit.com/r/ultralytics"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
44
45
 
45
- [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://pepy.tech/project/ultralytics-actions)
46
+ [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://www.pepy.tech/projects/ultralytics-actions)
46
47
 
47
48
  ## 📄 Actions Description
48
49
 
@@ -6,7 +6,7 @@ Welcome to the [Ultralytics Actions](https://github.com/ultralytics/actions) rep
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) [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml) <a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://reddit.com/r/ultralytics"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
8
8
 
9
- [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://pepy.tech/project/ultralytics-actions)
9
+ [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://www.pepy.tech/projects/ultralytics-actions)
10
10
 
11
11
  ## 📄 Actions Description
12
12
 
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.15"
25
+ __version__ = "0.0.25"
@@ -42,7 +42,7 @@ def generate_pr_summary(repo_name, diff_text):
42
42
  reply = get_completion(messages)
43
43
  if len(diff_text) > limit:
44
44
  reply = "**WARNING ⚠️** this PR is very large, summary may not cover all changes.\n\n" + reply
45
- return reply
45
+ return SUMMARY_START + reply
46
46
 
47
47
 
48
48
  def update_pr_description(repo_name, pr_number, new_summary, max_retries=2):
@@ -71,6 +71,46 @@ def update_pr_description(repo_name, pr_number, new_summary, max_retries=2):
71
71
  return update_response.status_code
72
72
 
73
73
 
74
+ def label_fixed_issues(pr_number):
75
+ """Labels issues that are closed by this PR when it's merged."""
76
+ # GraphQL query to get closing issues
77
+ query = """
78
+ query($owner: String!, $repo: String!, $pr_number: Int!) {
79
+ repository(owner: $owner, name: $repo) {
80
+ pullRequest(number: $pr_number) {
81
+ closingIssuesReferences(first: 50) {
82
+ nodes {
83
+ number
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ """
90
+
91
+ owner, repo = GITHUB_REPOSITORY.split("/")
92
+ variables = {"owner": owner, "repo": repo, "pr_number": pr_number}
93
+ graphql_url = "https://api.github.com/graphql"
94
+ response = requests.post(graphql_url, json={"query": query, "variables": variables}, headers=GITHUB_HEADERS)
95
+ if response.status_code != 200:
96
+ print(f"Failed to fetch linked issues. Status code: {response.status_code}")
97
+ return
98
+
99
+ try:
100
+ issues = response.json()["data"]["repository"]["pullRequest"]["closingIssuesReferences"]["nodes"]
101
+ for issue in issues:
102
+ issue_number = issue["number"]
103
+ label_url = f"{GITHUB_API_URL}/repos/{GITHUB_REPOSITORY}/issues/{issue_number}/labels"
104
+ label_response = requests.post(label_url, json={"labels": ["fixed"]}, headers=GITHUB_HEADERS)
105
+ if label_response.status_code == 200:
106
+ print(f"Added 'fixed' label to issue #{issue_number}")
107
+ else:
108
+ print(f"Failed to add label to issue #{issue_number}. Status: {label_response.status_code}")
109
+ except KeyError as e:
110
+ print(f"Error parsing GraphQL response: {e}")
111
+ return
112
+
113
+
74
114
  def main():
75
115
  """Summarize a pull request and update its description with an AI-generated summary."""
76
116
  pr_number = PR["number"]
@@ -90,6 +130,11 @@ def main():
90
130
  else:
91
131
  print(f"Failed to update PR description. Status code: {status_code}")
92
132
 
133
+ # Update linked issues
134
+ if PR.get("merged"):
135
+ print("PR is merged, labeling fixed issues...")
136
+ label_fixed_issues(PR["number"])
137
+
93
138
 
94
139
  if __name__ == "__main__":
95
140
  main()
@@ -23,8 +23,6 @@ if GITHUB_EVENT_PATH:
23
23
  PR = EVENT_DATA.get("pull_request", {})
24
24
  DISCUSSION = EVENT_DATA.get("discussion", {})
25
25
 
26
- INPUTS = {k[6:].lower(): v for k, v in os.environ.items() if k.startswith("INPUT_")} # actions inputs dictionary
27
-
28
26
 
29
27
  def get_pr_diff(pr_number: int) -> str:
30
28
  """Retrieves the diff content for a specified pull request in a GitHub repository."""
@@ -57,8 +55,12 @@ def graphql_request(query: str, variables: dict = None) -> dict:
57
55
 
58
56
  def check_pypi_version(pyproject_toml="pyproject.toml"):
59
57
  """Compares local and PyPI package versions to determine if a new version should be published."""
58
+ import re
59
+
60
60
  import tomllib # requires Python>=3.11
61
61
 
62
+ version_pattern = re.compile(r"^\d+\.\d+\.\d+$") # e.g. 0.0.0
63
+
62
64
  with open(pyproject_toml, "rb") as f:
63
65
  pyproject = tomllib.load(f)
64
66
 
@@ -73,6 +75,9 @@ def check_pypi_version(pyproject_toml="pyproject.toml"):
73
75
  local_version = next(line.split("=")[1].strip().strip("'\"") for line in f if line.startswith(attr_name))
74
76
 
75
77
  print(f"Local Version: {local_version}")
78
+ if not bool(version_pattern.match(local_version)):
79
+ print("WARNING: Incorrect local version pattern")
80
+ return "0.0.0", "0.0.0", False
76
81
 
77
82
  # Get online version from PyPI
78
83
  response = requests.get(f"https://pypi.org/pypi/{package_name}/json")
@@ -111,6 +116,7 @@ def ultralytics_actions_info():
111
116
  "github.ref": os.environ.get("GITHUB_REF"),
112
117
  "github.head_ref": os.environ.get("GITHUB_HEAD_REF"),
113
118
  "github.base_ref": os.environ.get("GITHUB_BASE_REF"),
119
+ "github.base_sha": PR.get("base", {}).get("sha"),
114
120
  }
115
121
 
116
122
  if GITHUB_EVENT_NAME == "discussion":
@@ -122,7 +128,7 @@ def ultralytics_actions_info():
122
128
  )
123
129
 
124
130
  # Print information
125
- max_key_length = max(len(key) for key in info.keys())
131
+ max_key_length = max(len(key) for key in info)
126
132
  header = f"Ultralytics Actions {__version__} Information " + "-" * 40
127
133
  print(header)
128
134
  for key, value in info.items():
@@ -9,7 +9,7 @@ import requests
9
9
  from actions.utils.common_utils import check_links_in_string
10
10
 
11
11
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
12
- OPENAI_MODEL = os.getenv("OPENAI_MODEL", "gpt-4o")
12
+ OPENAI_MODEL = os.getenv("OPENAI_MODEL", "gpt-4o-2024-11-20")
13
13
 
14
14
 
15
15
  def get_completion(
@@ -57,6 +57,7 @@ classifiers = [
57
57
  "Programming Language :: Python :: 3.10",
58
58
  "Programming Language :: Python :: 3.11",
59
59
  "Programming Language :: Python :: 3.12",
60
+ "Programming Language :: Python :: 3.13",
60
61
  "Topic :: Software Development",
61
62
  "Topic :: Software Development :: Libraries :: Python Modules",
62
63
  "Topic :: Internet :: WWW/HTTP",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics-actions
3
- Version: 0.0.15
3
+ Version: 0.0.25
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>
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Topic :: Software Development
24
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
26
  Classifier: Topic :: Internet :: WWW/HTTP
@@ -42,7 +43,7 @@ Welcome to the [Ultralytics Actions](https://github.com/ultralytics/actions) rep
42
43
 
43
44
  [![GitHub Actions Marketplace](https://img.shields.io/badge/Marketplace-Ultralytics_Actions-blue?style=flat&logo=github)](https://github.com/marketplace/actions/ultralytics-actions) [![Ultralytics Actions](https://github.com/ultralytics/actions/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/actions/actions/workflows/format.yml) <a href="https://discord.com/invite/ultralytics"><img alt="Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a> <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a> <a href="https://reddit.com/r/ultralytics"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
44
45
 
45
- [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://pepy.tech/project/ultralytics-actions)
46
+ [![PyPI version](https://badge.fury.io/py/ultralytics-actions.svg)](https://badge.fury.io/py/ultralytics-actions) [![Downloads](https://static.pepy.tech/badge/ultralytics-actions)](https://www.pepy.tech/projects/ultralytics-actions)
46
47
 
47
48
  ## 📄 Actions Description
48
49