Skip to content

Commit 0379125

Browse files
committed
fix(#259): check include too
1 parent 147d318 commit 0379125

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

sr-data/src/sr_data/steps/workflows.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,21 @@ def workflow_info(content):
8585
for job, jdetails in jobs:
8686
runs = jdetails.get("runs-on")
8787
if runs is not None and runs.startswith("$"):
88-
for matrixed in jdetails.get("strategy").get("matrix").get(
89-
runs.strip()
88+
matrix = jdetails.get("strategy").get("matrix")
89+
key = runs.strip().replace("${{", "").replace("}}", "").split(".")[1].strip()
90+
if matrix.get(key):
91+
for matrixed in matrix.get(key):
92+
oss.append(matrixed)
93+
elif matrix.get("include"):
94+
for include in matrix.get("include"):
95+
oss.append(
96+
include.get(
97+
runs.strip()
9098
.replace("${{", "")
9199
.replace("}}", "")
92100
.split(".")[1].strip()
93-
):
94-
oss.append(matrixed)
101+
)
102+
)
95103
elif runs is not None:
96104
oss.append(runs)
97105
steps = jdetails.get("steps")

sr-data/src/tests/resources/to-workflows.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ init4tech/zenith-rs,main,rust-ci.yml
77
LevBeta/Agil,master,
88
dcodesdev/rustfinity.com,main,"ci.yaml,rustfinity-runner.yaml"
99
gordnzhou/imnes-emulator,main,
10-
lanylow/honkai-dumper,main,
10+
lanylow/honkai-dumper,main,
11+
BillyDM/vitalium-verb,main,"build.yml"

sr-data/src/tests/test_workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_collects_unique_oss_across_all_files(self):
109109
f"OSS count: {oss} does not match with expected: {expected}"
110110
)
111111

112-
@pytest.mark.nightly
112+
@pytest.mark.fast
113113
def test_collects_workflows_for_all(self):
114114
with TemporaryDirectory() as temp:
115115
path = os.path.join(temp, "workflows.csv")

0 commit comments

Comments
 (0)