ultralytics-actions 0.0.22__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.
- {ultralytics_actions-0.0.22/ultralytics_actions.egg-info → ultralytics_actions-0.0.25}/PKG-INFO +1 -1
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/__init__.py +1 -1
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/summarize_pr.py +45 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/utils/github_utils.py +7 -2
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25/ultralytics_actions.egg-info}/PKG-INFO +1 -1
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/LICENSE +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/README.md +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/first_interaction.py +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/summarize_release.py +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/update_markdown_code_blocks.py +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/utils/__init__.py +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/utils/common_utils.py +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/utils/openai_utils.py +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/pyproject.toml +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/setup.cfg +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/SOURCES.txt +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/entry_points.txt +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/requires.txt +0 -0
- {ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/top_level.txt +0 -0
{ultralytics_actions-0.0.22/ultralytics_actions.egg-info → ultralytics_actions-0.0.25}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ultralytics-actions
|
3
|
-
Version: 0.0.
|
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>
|
@@ -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")
|
{ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25/ultralytics_actions.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ultralytics-actions
|
3
|
-
Version: 0.0.
|
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>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/actions/update_markdown_code_blocks.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/requires.txt
RENAMED
File without changes
|
{ultralytics_actions-0.0.22 → ultralytics_actions-0.0.25}/ultralytics_actions.egg-info/top_level.txt
RENAMED
File without changes
|