File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ set -e -u -o pipefail
4
4
5
5
cd projects
6
6
7
+ github_auth=()
8
+ if [[ -n " ${GITHUB_TOKEN:- } " ]]; then
9
+ github_auth=(--header " Authorization: Bearer $GITHUB_TOKEN " )
10
+ fi
11
+
7
12
for d in * /; do
8
13
d=" ${d%/ } "
9
14
pushd " $d "
@@ -15,10 +20,10 @@ for d in */; do
15
20
mkdocs_yml=" ${BASH_REMATCH[3]} "
16
21
else
17
22
repo=" ${d// --// } "
18
- branch=$( curl -sfL " https://api.github.com/repos/$repo " | jq -r ' .default_branch' )
23
+ branch=$( curl -sfL " ${github_auth[@]} " " https://api.github.com/repos/$repo " | jq -r ' .default_branch' )
19
24
mkdocs_yml=' mkdocs.yml'
20
25
fi
21
- [[ " $( curl -sfL " https://api.github.com/repos/$repo /commits?per_page=1&sha=$branch " | jq -r ' .[0].commit.url' ) " =~ ^https://api.github.com/repos/([^/]+/[^/]+)/git/commits/([0-9a-f]+)$ ]]
26
+ [[ " $( curl -sfL " ${github_auth[@]} " " https://api.github.com/repos/$repo /commits?per_page=1&sha=$branch " | jq -r ' .[0].commit.url' ) " =~ ^https://api.github.com/repos/([^/]+/[^/]+)/git/commits/([0-9a-f]+)$ ]]
22
27
repo=" ${BASH_REMATCH[1]} "
23
28
commit=" ${BASH_REMATCH[2]} "
24
29
echo " https://github.com/$repo /blob/$branch /$mkdocs_yml " | tee /dev/stderr > project.txt
You can’t perform that action at this time.
0 commit comments