Repository checkout deployment



Can I get the repository checkout(pull) result in a file after the ‘git pull/clone’ was finished?
Thing is I want to parse the content to see which sub-directory had changes so I can do a fine-grained deployment ONLY from the sub-directories in my repository that had changes…

Longer version:
The repository that I use has 3 different sub-directories. These sub-directories represent 3 different applications that are to be deployed (on AWS):

  • /worker
  • /frontsite
  • /backoffice

Since on every deploy on a branch, I do a full redeploy of all 3 applications, this process takes time and it’s not really mandatory if I only have changes for example in the ‘/worker’ directory. I’d like to to a conditional deploy from only the changed sub-dirs.
If I could access the git pull result, I could parse this using a bash script and only deploy from the sub-directories that have changes in the last commit.


This should definitely be possible. This blog post, although it’s not exactly what you’re looking to do, should give you a good starting point:

Instead of modifying the commit message with [skip ci] you could add variations appropriate to your needs.

Then on CircleCI via circle.yml you can inspect the git commit message (see here for how: Git Commit Message in Environment Variable) and run deployment steps conditionally based on if the relevant string is found in the commit message.

If you get something like that working we’d be delighted if you wanted to share the steps you took / any gotchas.


Here’s what I did to get this working:

  • set the following as a pre-test command:

_git show --pretty="" --name-only(git log --format="%H" -n 2 $CIRCLE_SHA1)> gitlog.txt

This outputs only the changed files in the commit and places this in the ‘gitlog.txt’ file. The content of this file for the last commit looks something like this:



  • now, since I have the git changes, I parsed the file content using a simple bash script and based on the directory prefix (in this case **front/**views/layout.hbs), I deployed the application to AWS. The deployment logic is housed in this script and it is executed as the command in the deployment step: chmod +x; ./ default