Skip to content

Commit b8806d4

Browse files
committed
read props from all repos
Signed-off-by: Andrew Brandt <[email protected]>
1 parent 57a5ed1 commit b8806d4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

action.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,36 @@ runs:
4343
cat org-name.txt
4444
echo "Full list of repos in org:"
4545
cat repo-list.txt
46+
47+
- name: Fetch custom properties for each repo
48+
shell: bash
49+
env:
50+
GH_TOKEN: ${{ inputs.token }}
51+
run: |
52+
ORG_NAME="${GITHUB_REPOSITORY%%/*}"
53+
echo "Fetching custom properties for repos in org: ${ORG_NAME}"
54+
55+
echo "{" > repo-properties.json
56+
FIRST=1
57+
while IFS= read -r REPO_NAME; do
58+
echo "Getting properties for ${REPO_NAME}..."
59+
RESPONSE=$(gh api "repos/${ORG_NAME}/${REPO_NAME}/properties/values" || echo "{}")
60+
61+
# If not the first, prepend a comma to separate JSON entries
62+
if [ "$FIRST" -eq 0 ]; then
63+
echo "," >> repo-properties.json
64+
fi
65+
FIRST=0
66+
67+
# Output as "repo-name": { ...props... }
68+
echo "\"${REPO_NAME}\": $RESPONSE" >> repo-properties.json
69+
done < repo-list.txt
70+
echo "}" >> repo-properties.json
71+
72+
echo "Custom properties written to repo-properties.json"
73+
74+
- name: Print out the full repo-properties.json file
75+
shell: bash
76+
run: |
77+
echo "Full repo-properties.json file is:"
78+
cat repo-properties.json

0 commit comments

Comments
 (0)