Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-18543

Pull Request hash as Bamboo variable

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • None
    • Pull Requests
    • None
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      Problem Definition

      There is currently no variable for pull request hashes.

      Suggested Solution

      Add a Bamboo variable, such as ${bamboo.repository.pullRequest}

      Workaround

      As a workaround, you can use your version control system's API. Below are examples of possible GitHub and Bitbucket Server API calls.

      GitHub

      API call
      curl -s -u<username>:<personal-access-token> https://api.github.com/repos/<owner>/<repository>/pulls | grep merge_commit_sha|awk -F'"' '{print $4}'

      Bitbucket Server

      API call
      curl -s -u<username>:<pasword> "<bitbucket-url>/rest/api/1.0/projects/<project-key>/repos/<repo-slug>/pull-requests"|json_pp|grep 'latestCommit\|Ref'
      Enter host password for user 'ezeidan':
               "toRef" : {
                  "latestCommit" : "9f99052b726d18a3c8d62ba9e02f0d09519bedfa",
               "fromRef" : {
                  "latestCommit" : "92006c7ce897a0fb4d8faacd7a0d79d887728925",
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ezeidan Elias Zeidan (they/them)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: