Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace master references with default branch name fetched from github api #141

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion circleci/breakdown-sync
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ set -e

: ${CIRCLE_BRANCH?"Missing required env var"}
BRANCH=$CIRCLE_BRANCH
if [[ $BRANCH != "master" ]]; then
: ${CIRCLE_PROJECT_REPONAME?"Missing required env var"}
REPO=$CIRCLE_PROJECT_REPONAME
: ${GITHUB_TOKEN?"Missing required env var"}
DEFAULT_BRANCH=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/Clever/$REPO" | jq -r '.default_branch')

if [[ $BRANCH != $DEFAULT_BRANCH ]]; then
echo "Skipping sync for non-master branch"
exit 0
fi
Expand Down
7 changes: 6 additions & 1 deletion circleci/catalog-sync
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ set -e

: ${CIRCLE_BRANCH?"Missing required env var"}
BRANCH=$CIRCLE_BRANCH
if [[ $BRANCH != "master" ]]; then
: ${CIRCLE_PROJECT_REPONAME?"Missing required env var"}
REPO=$CIRCLE_PROJECT_REPONAME
: ${GITHUB_TOKEN?"Missing required env var"}
DEFAULT_BRANCH=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/Clever/$REPO" | jq -r '.default_branch')
if [[ $BRANCH != $DEFAULT_BRANCH ]]; then
echo "Skipping sync for non-master branch"
exit 0
fi
Expand Down
6 changes: 4 additions & 2 deletions circleci/output-force-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
REPO=$CIRCLE_PROJECT_REPONAME
: ${CIRCLE_PROJECT_USERNAME?"Missing required env var"}
USER=$CIRCLE_PROJECT_USERNAME

: ${GITHUB_TOKEN?"Missing required env var"}
DEFAULT_BRANCH=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/Clever/$REPO" | jq -r '.default_branch')
echo "frontend-test failed! As a result, your deploy will not start automatically."
echo "If you think this is a transient issue, try re-running this job with the \"Rerun from failed\" option."
echo "To force deploy, do the following:"
Expand All @@ -14,7 +16,7 @@ echo "2) Run the following command, replacing CIRCLE_API_TOKEN with the token fr
echo "curl -u CIRCLE_API_TOKEN: \\
-X POST \\
--header \"Content-Type: application/json\" -d '{
\"branch\": \"master\",
\"branch\": \"${DEFAULT_BRANCH}\",
\"parameters\": {
\"force_deploy\": true
}
Expand Down