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
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,23 @@ runs:
168175 python - <<END
169176 import os
170177 import yaml
178+ import json
179+ import copy
171180 from datetime import datetime
172181
173182 def set_default(d, key, default_value):
174183 if not isinstance(d, dict):
175184 return
176185 if key not in d:
177186 d[key] = default_value
187+
188+ repositories = json.loads(os.environ.get('ORGANIZATION_REPOS'))
189+ repositoryUrls = [repository['html_url'] for repository in repositories]
190+
191+ support = []
192+
193+ for repository in repositoryUrls:
194+ support.append({"software": repository, "type": "community"})
178195
179196 # Read existing opencatalogi.yaml
180197 try:
@@ -193,9 +210,9 @@ runs:
193210 set_default(data, 'contact', {})
194211 set_default(data['contact'], 'email', "")
195212 set_default(data['contact'], 'phone', "")
196- set_default(data, 'softwareOwned', [] )
197- set_default(data, 'softwareUsed', [] )
198- set_default(data, 'softwareSupported', [] )
213+ set_default(data, 'softwareOwned', copy.copy(repositoryUrls) )
214+ set_default(data, 'softwareUsed', copy.copy(repositoryUrls) )
215+ set_default(data, 'softwareSupported', support )
199216
200217 # Write updated opencatalogi.yaml
201218 with open("opencatalogi.yaml", "w") as f:
0 commit comments