diff --git a/dependencies.sh b/dependencies.sh index b1adb86..c08c309 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -34,9 +34,13 @@ sum=$(( $sum + $? )) if [[ $1 != *"victoire/victoire"* ]]; then revision=$(cd ../../../ && git rev-parse HEAD) - url="https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER"; - branch=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$url" | jq '.head.ref' | tr -d '""') + url="https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER"; + if [ -z "${GITHUB_TOKEN}" ]; then + branch=$(curl -s "$url" | jq -r '.head.ref') + else + branch=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$url" | jq '.head.ref' | tr -d '""') + fi # https://stackoverflow.com/questions/584894/environment-variable-substitution-in-sed # Manage varenv in sed sed -i 's@"name": "victoire/victoire",@"name": "victoire/victoire","repositories": [{"type": "vcs", "url": "https://github.com/'"${CIRCLE_PR_USERNAME}"'/'"${CIRCLE_PR_REPONAME}"'"}],@' composer.json