Skip to content

Commit 5000f09

Browse files
committed
Use python script instead of bash script
1 parent af3d27f commit 5000f09

File tree

3 files changed

+50
-41
lines changed

3 files changed

+50
-41
lines changed

.github/foss_project_collector.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2023 Ericsson AB
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
import json
17+
import sys
18+
import glob
19+
20+
21+
IGNORED_FOLDER_LIST = [
22+
"templates",
23+
"__pycache__",
24+
".pytest_cache",
25+
]
26+
27+
def main():
28+
projects_dir = os.getenv("PROJECTS_DIR")
29+
if not projects_dir:
30+
print("[ERROR] PROJECTS_DIR not set!", file=sys.stderr)
31+
sys.exit(1)
32+
33+
project_list = []
34+
35+
for project_folder in glob.glob(os.path.join(projects_dir, "*/")):
36+
project_name = os.path.basename(os.path.normpath(project_folder))
37+
38+
if project_name not in IGNORED_FOLDER_LIST:
39+
project_list.append(
40+
{"name": project_name, "folder": project_folder}
41+
)
42+
43+
final_matrix_json = json.dumps(project_list)
44+
45+
print(f"matrix_json={final_matrix_json}")
46+
47+
48+
if __name__ == "__main__":
49+
main()

.github/foss_project_collector.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/foss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
env:
4545
PROJECTS_DIR: "./test/foss/"
4646
run: |
47-
./.github/foss_project_collector.sh >> "$GITHUB_OUTPUT"
47+
python3 ./.github/foss_project_collector.py >> "$GITHUB_OUTPUT"
4848
shell: bash
4949

5050
# TODO: Add script to run tests locally

0 commit comments

Comments
 (0)