Skip to content

Commit bcb9a08

Browse files
committed
ci: enable to set dependencies label for GH Actions updates
1 parent 494b474 commit bcb9a08

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/pr-labels.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ jobs:
117117
import os
118118
import pathlib
119119
import subprocess
120+
import re
120121
121122
pr_number = os.environ["PR_NUMBER"]
122123
codex_output_path = pathlib.Path(os.environ["CODEX_OUTPUT_PATH"])
123124
changed_files_path = pathlib.Path(".tmp/pr-labels/changed-files.txt")
125+
changes_diff_path = pathlib.Path(".tmp/pr-labels/changes.diff")
124126
125127
changed_files = []
126128
if changed_files_path.exists():
@@ -137,6 +139,20 @@ jobs:
137139
desired.add("documentation")
138140
if "uv.lock" in changed_files:
139141
desired.add("dependencies")
142+
if changes_diff_path.exists():
143+
diff_text = changes_diff_path.read_text()
144+
current_file = None
145+
for line in diff_text.splitlines():
146+
if line.startswith("+++ b/"):
147+
current_file = line[len("+++ b/") :].strip()
148+
continue
149+
if not current_file or not current_file.startswith(".github/workflows/"):
150+
continue
151+
if not line.startswith(("+", "-")):
152+
continue
153+
if re.search(r"uses:\s*(?!\./)(?!\.\/)[^@\s]+/[^@\s]+@", line):
154+
desired.add("dependencies")
155+
break
140156
141157
allowed = {
142158
"documentation",

0 commit comments

Comments
 (0)