Skip to content

Commit 3eef317

Browse files
authored
Add software links
Set softwareUsed, softwareOwned and softwareSupported with the found data.
1 parent f1d4379 commit 3eef317

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

action.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ runs:
4949
- name: Set up Python
5050
uses: actions/setup-python@v2
5151
with:
52-
python-version: '3.x'
52+
python-version: '3.x'
53+
# Fetch repositories of the github organization
54+
- name: Get Repositories for github organization
55+
uses: raven-actions/get-repos@v1.0.2
56+
if: (contains(github.repository, '.github'))
57+
id: get-repos
5358
# Transfer the repossitory data to the container
5459
- name: Transfer the repossitory data to the container
5560
shell: bash
@@ -66,6 +71,8 @@ runs:
6671
echo "ORGANISATION_GITID=${{ github.event.organization.id}}" >> $GITHUB_ENV
6772
echo "ORGANISATION_URL=${{ github.event.organization.login }}" >> $GITHUB_ENV
6873
echo "ORGANISATION_AVATAR=${{ github.event.organization.avatar_url }}" >> $GITHUB_ENV
74+
75+
echo "ORGANIZATION_REPOS=${{ steps.get-repos.outputs.repos }} >> $GITHUB_ENV
6976
7077
echo "Installing PyYAML..."
7178
pip install PyYAML
@@ -168,13 +175,22 @@ runs:
168175
python - <<END
169176
import os
170177
import yaml
178+
import json
171179
from datetime import datetime
172180
173181
def set_default(d, key, default_value):
174182
if not isinstance(d, dict):
175183
return
176184
if key not in d:
177185
d[key] = default_value
186+
187+
repositories = json.loads(os.environ.get('ORGANIZATION_REPOS'))
188+
repositoryUrls = [repository['html_url'] for repository in repositories]
189+
190+
support = []
191+
192+
for respository in repositoryUrls:
193+
$support.append = {"software": repository, "type": "community"}
178194
179195
# Read existing opencatalogi.yaml
180196
try:
@@ -193,9 +209,9 @@ runs:
193209
set_default(data, 'contact', {})
194210
set_default(data['contact'], 'email', "")
195211
set_default(data['contact'], 'phone', "")
196-
set_default(data, 'softwareOwned', [])
197-
set_default(data, 'softwareUsed', [])
198-
set_default(data, 'softwareSupported', [])
212+
set_default(data, 'softwareOwned', repositoryUrls)
213+
set_default(data, 'softwareUsed', repositoryUrls)
214+
set_default(data, 'softwareSupported', support)
199215
200216
# Write updated opencatalogi.yaml
201217
with open("opencatalogi.yaml", "w") as f:

0 commit comments

Comments
 (0)