Skip to content

Commit

Permalink
Merge pull request #18 from virtuoushub/fix-private-repo-logic
Browse files Browse the repository at this point in the history
fix: public/private repo logic
  • Loading branch information
William Lauzé authored Jun 2, 2020
2 parents d953423 + 1dfcc4c commit cabb284
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions commitlint_range.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ then
echo "This is a pull request"
PULL_REQUEST_NUMBER=$(echo "${CIRCLE_PULL_REQUEST}" | cut -d/ -f7)
PULL_REQUEST_DETAILS=$(curl https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${PULL_REQUEST_NUMBER})
REPO_IS_PRIVATE=$(echo "${PULL_REQUEST_DETAILS}" | jq -r .url)
if [ -n "${REPO_IS_PRIVATE}" ]
REPO_IS_PUBLIC=$(echo "${PULL_REQUEST_DETAILS}" | jq -r .url)
if [ -n "${REPO_IS_PUBLIC}" ]
then
echo "Public repo"
else
echo "Private repo"
PULL_REQUEST_DETAILS=$(curl -H "Authorization: token ${GITHUB_TOKEN_COMMITLINT}" https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${PULL_REQUEST_NUMBER})
else
echo "Public repo"
fi

BASE_SHA1=$(echo "${PULL_REQUEST_DETAILS}" | jq -r .base.sha)
Expand All @@ -37,4 +37,4 @@ else
fi
fi
echo "${COMMIT_RANGE}"
git log ${COMMIT_RANGE} --pretty=%B | commitlint
git log ${COMMIT_RANGE} --pretty=%B | commitlint

0 comments on commit cabb284

Please sign in to comment.