Search code examples
herokuheroku-pipelines

How to know if there are changes to promote on Heroku pipeline platform?


My objective is to write a script that promotes a "stage" application in our Heroku pipeline to production, but only if there are any changes to promote.

I can promote without issues by using:

// POST /pipeline-promotions
{
    "pipeline": {
        "id": "<pipeline-id>"
    },
    "source": {
        "app": {
            "id": "<stage-app-id>"
        }
    },
    "targets": [
        {
            "app": {
                "id": "<production-id>"
            }
        }
        
    ]
}

My issues is that if I execute this, without any changes are present, the release actions are still started on the production application.

In other words, how can I determine if any changes are available for promotion - just like heroku does in their GUI?

enter image description here


Solution

  • Thanks to Heroku support, I managed to figure this out.

    It can be done by comparing the slug id's when looking at pipelines/<pipeline-id>/latest-releases.

    If the slug-ids are the same, there are no changes to promote.