@@ -76,8 +76,29 @@ curl --fail --show-error -o pages/learn/more/masterclasses/docker-masterclass.md
76
76
cd shared/projects/ && {
77
77
echo " Name|Description
78
78
---|---" | tee balena-labs-projects.md balena-example-projects.md > /dev/null
79
- curl --fail --show-error https://api.github.com/orgs/balena-labs-projects/repos? per_page=30 | $JQ -r ' sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >> balena-labs-projects.md
80
- curl --fail --show-error https://api.github.com/orgs/balena-io-examples/repos? per_page=100 | $JQ -r ' sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >> balena-example-projects.md
79
+
80
+ # Set up authentication headers if GITHUB_TOKEN is available
81
+ if [ -n " ${GITHUB_TOKEN:- } " ]; then
82
+ AUTH_HEADER=" Authorization: token $GITHUB_TOKEN "
83
+ else
84
+ AUTH_HEADER=" "
85
+ echo " Warning: GITHUB_TOKEN not set. GitHub API calls may be rate limited."
86
+ fi
87
+
88
+ # Fetch balena-labs-projects with error handling
89
+ if [ -n " $AUTH_HEADER " ]; then
90
+ curl --fail --show-error -H " $AUTH_HEADER " https://api.github.com/orgs/balena-labs-projects/repos? per_page=30 | $JQ -r ' sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >> balena-labs-projects.md || echo " Failed to fetch balena-labs-projects" >&2
91
+ else
92
+ curl --fail --show-error https://api.github.com/orgs/balena-labs-projects/repos? per_page=30 | $JQ -r ' sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >> balena-labs-projects.md || echo " Failed to fetch balena-labs-projects (rate limited)" >&2
93
+ fi
94
+
95
+ # Fetch balena-io-examples with error handling
96
+ if [ -n " $AUTH_HEADER " ]; then
97
+ curl --fail --show-error -H " $AUTH_HEADER " https://api.github.com/orgs/balena-io-examples/repos? per_page=100 | $JQ -r ' sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >> balena-example-projects.md || echo " Failed to fetch balena-io-examples" >&2
98
+ else
99
+ curl --fail --show-error https://api.github.com/orgs/balena-io-examples/repos? per_page=100 | $JQ -r ' sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >> balena-example-projects.md || echo " Failed to fetch balena-io-examples (rate limited)" >&2
100
+ fi
101
+
81
102
cd -
82
103
} &
83
104
0 commit comments