You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hey Team,
I would like to know how to get the Pull Request title as a Variable in Pipeline.
The below document gives a list of default variables, but can't find what I am looking for.
https://support.atlassian.com/bitbucket-cloud/docs/variables-in-pipelines/
You can get the title of a pull-request via the API.
The BITBUCKET_PR_ID is available as environment variable if the pipeline is a pull-request pipeline.
I am getting the error
Access denied. You must have write or admin access.
and I am the Admin of the Repo and Workspace.
Also is there a way I can get the Pull request title as a Variable just like BITBUCKET_PR_ID?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@tony.thomas Yes, as written, you can get the PR title as output from the API. The output can be assigned to a variable (e.g. with utilities like jq or similar).
This requires using the API successfully first. Please check the existing Q&A and support resources for that incl. trouble-shooting. Some more references:
If it still does not work for you, please provide the example.
Example with the curl and the jq utilities (working API authentication with necessary access rights required):
- |
BITBUCKET_PR_TITLE="$(\
curl ... -fsS -H 'Content-Type: application/json' \
"https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_FULL_NAME}"\
"/pullrequests/${BITBUCKET_PR_ID}" \
| jq -r '.title')" \
; test "$BITBUCKET_PR_TITLE"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@tony.thomas , you can add on the curl command provided by @ktomk a header for bearer token:
--header 'Authorization: Bearer XXXXXX'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.