-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The text here should also get updated, so that if the primary branch is ever named |
||
exit 0 | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:" | ||
|
@@ -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}\", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the plan to accompany this with catapult changes? This would probably not behave as expected with just the CI changes if a team were to change their primary branch name. |
||
\"parameters\": { | ||
\"force_deploy\": true | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this token need to be added and rotated in all CI projects?