Running action conditional on whether there are more executions queued

Hi there,

I have a third-party app that publishes new commits in quick succession to a GitHub repository that I want Buddy to monitor. Most times this app will push 2 commits within a minute, but other times it could push up to 120 commits over a period of a few minutes.

I want to create a Buddy pipeline that monitors pushes to this repo, whose last action – an email success notification – only runs if the pipeline has no further executions in its queue. The idea is to only send out a single email success notification after all the successive executions have been run (rather than one for each execution).

I’ve been looking at the list of default environment variables but don’t see anything that would give me the number of currently queued executions.

Is there an API call or something that I can run in an action that can find out whether the currently executed pipeline has other queued executions? Then I could assign the result to an environment variable that the email action could be conditional upon.

Thank you!

Update: Solved it by writing a Node.js script that calls a GET request on Buddy REST API on the current pipeline’s list of executions, looks for any “ENQUEUED” execution, and returns with a particular error code if there is. Then I assign an environment variable which I make the email notification action conditional on.