You’re doing it almost good
What you have to know about Bash (it seems you use a Bash script here) is that env var (or any other variable, expansion, etc.) are not handled in single quoted strings. E.g.
echo '$HOME'
will print $HOME
, while
echo "$HOME"
will print the value of $HOME
(e.g. /Users/myuser
).
So, in the case you posted:
curl -H "Content-Type: application/json" -X POST "https://our.build.server/rest/build-status/1.0/commits/$PRCommit" --data "{\"state\": \"INPROGRESS\", \"key\": \"$BITRISE_BUILD_NUMBER\", \"url\": \"$BITRISE_BUILD_URL\"}"
should work.
Note: you have to escape double quotes inside the double quoted string!