Skip to content

Commit d86eb38

Browse files
author
Bastien Orivel
committed
Don't generate keyboard tasks for targets that don't exist
1 parent 93e24fc commit d86eb38

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

decision_task.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def tasks(task_for: str):
5656

5757
# Keyboard repositories common tasks
5858
if repo_name.startswith("keyboard-"):
59-
for os_ in {"windows-latest", "macos-latest"}:
60-
create_kbd_task(os_)
59+
create_kbd_tasks()
6160

6261
# pahkat-reposrv tasks
6362
if repo_name == "pahkat-reposrv":

tasks/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .lang_task import create_lang_tasks
2-
from .kbd_task import create_kbd_task
2+
from .kbd_task import create_kbd_tasks
33
from .pahkat import create_pahkat_tasks
44
from .pahkat_reposrv import (
55
create_pahkat_reposrv_task,

tasks/kbd_task.py

+18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
from gha import GithubAction
22
from decisionlib import CONFIG
33
from .common import macos_task, windows_task, gha_setup, gha_pahkat, NIGHTLY_CHANNEL
4+
import subprocess
5+
import os
46

57

8+
def create_kbd_tasks():
9+
print(subprocess.check_output("git init repo && cd repo && git fetch --depth 1 {} {} && git reset --hard FETCH_HEAD".format(CONFIG.git_url, CONFIG.git_ref)))
10+
has_windows_target = False
11+
has_macos_target = False
12+
13+
for f in os.listdir('repo'):
14+
if f.endswith('.kbdgen'):
15+
bundle_path = os.path.join("repo", f)
16+
has_macos_target = os.path.isfile(os.path.join(bundle_path, "targets", "macos.yaml"))
17+
has_windows_target = os.path.isfile(os.path.join(bundle_path, "targets", "windows.yaml"))
18+
19+
if has_macos_target:
20+
create_kbd_task("macos-latest")
21+
if has_windows_target:
22+
create_kbd_task("windows-latest")
23+
624
def create_kbd_task(os_name):
725
if os_name == "windows-latest":
826
return (

0 commit comments

Comments
 (0)