Running commands against PR branches

[EDIT] This does not work for PRs containing multiple commits. CIRCLE_COMPARE_URL refers to diffs introduced by a single git push.

You can follow this idea:

Here is a code example:

#CIRCLE_COMPARE_URL=https://github.com/dtprotel/protel360/compare/e8f67d33a268...1d340f4990b5
#Parsing this variable inside circle ci exports.

#Get Commit Ids Part
COMMIT_ID_PARTS=""
IFS='/'
splittedArray=$CIRCLE_COMPARE_URL
for x in $splittedArray
do
    COMMIT_ID_PARTS=$x
done
printf "> Build is between commits : $COMMIT_ID_PARTS\n"

(source NameBright - Coming Soon)