Skip to content

Commit

Permalink
Consider draft entry
Browse files Browse the repository at this point in the history
  • Loading branch information
a-know committed Jun 2, 2018
1 parent d061ff9 commit b74af09
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ jobs:
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then
blogsync pull a-know.hateblo.jp
git add -N .
if [ -n "`git status -sb | grep entry`" ]; then
BRANCH=blog-update-`date -u "+%Y%m%d"`
git config --global user.email ${MY_EMAIL}
git config --global user.name ${MY_NAME}
git checkout -b ${BRANCH}
git add .
git commit -m "Automatic blog update `date -u '+%Y-%m-%d'`"
if git push ${CIRCLE_REPOSITORY_URL} ${BRANCH}
then
curl \
--header "Accept: application/vnd.github.v3+json" \
--data "{\"title\": \"${BRANCH}\", \"head\": \"${CIRCLE_PROJECT_USERNAME}:${BRANCH}\", \"base\":\"${CIRCLE_BRANCH}\" }" \
https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls?access_token=${GITHUB_ACCESS_TOKEN}
if [ -z "`git diff | grep Draft`" ]; then
BRANCH=blog-update-`date -u "+%Y%m%d"`
git config --global user.email ${MY_EMAIL}
git config --global user.name ${MY_NAME}
git checkout -b ${BRANCH}
git add .
git commit -m "Automatic blog update `date -u '+%Y-%m-%d'`"
if git push ${CIRCLE_REPOSITORY_URL} ${BRANCH}
then
curl \
--header "Accept: application/vnd.github.v3+json" \
--data "{\"title\": \"${BRANCH}\", \"head\": \"${CIRCLE_PROJECT_USERNAME}:${BRANCH}\", \"base\":\"${CIRCLE_BRANCH}\" }" \
https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls?access_token=${GITHUB_ACCESS_TOKEN}
fi
fi
fi
fi
Expand Down

0 comments on commit b74af09

Please sign in to comment.