Environment variable with pull request number


Current when a build is triggered by a PR, Buddy set the environment variable BUDDY_EXECUTION_PULL_REQUEST_ID to pull/<PR number>. It’s quite confusing as the name of the variable suggest it contains just the PR number.
It would probably make more sense to set its value to 15 rather pull/15.


Hi Pierre,
Could you send some screenshots? We must be 100% sure that we mean the same.


It’s about the content of the BUDDY_EXECUTION_PULL_REQUEST_ID environment variable.
For example in the build https://app.buddy.works/pierredenisvanduynslager/playground/pipelines/pipeline/150986/execution/5ba1330163115e522d4eaf72 which was triggered by a Pull Request, BUDDY_EXECUTION_PULL_REQUEST_ID is set to pull/23. It would make more sense to set it to 23.
My pipeline just run the command env to display all the environment variables.

I’m not sure which screenshot you would like. You can see the value of BUDDY_EXECUTION_PULL_REQUEST_ID in the logs: https://app.buddy.works/pierredenisvanduynslager/playground/pipelines/pipeline/150986/execution/5ba1330163115e522d4eaf72/action/249935/logs


We have the same question. We are trying to use this to tag Docker images in our repo with the Pull request number and are getting pull/18 when we would expect just the integer value of 18. Is there a different environment variable that we should use to get the integer of the pull request? If not, we will have to write some sort of regex extraction to work around this unfortunately.

Is there an update as to whether this is a bug or intended and if it’s going to get fixed?



Thanks for the response guys, let me consult with the team if there’s a solution to that. Stay tuned.


The task for that is currently in the backlog. For now you can work around it by adding a settable variable to the pipeline (for example PR_ID) + adding the Local Shell action in which you can assign the cut value from BUDDY_EXECUTION_PULL_REQUEST_ID to that variable.

Hope that’s clear!


cc: @pvdlg @jrichard0725
FYI we’ve just released an update which adds $BUDDY_EXECUTION_PULL_REQUEST_NO to the list of default variables. That should solve your issue :slight_smile:


@Kivlov – Can you ensure all options for the supported Default Environment Variables are listed in the docs:

The $BUDDY_EXECUTION_PULL_REQUEST_NO appears to be missing. Maybe there are others?


Hey @geoff,
We have updated the list with all working variables. Closing this thread now.