The use case is to retrieve a list of changed files: as you mentioned, Bitbucket doesn’t provide this information as part of the payload directly available to a post-receive hook, but ScriptRunner offers a convenience function that retrieves the information via Bitbucket’s APIs. The operation of this function is as follows:
- Use
CommitService
to retrieve a list of commits involved in the pull request (getCommitsBetween
). - For each commit, use
CommitService
again to retrieve the list of changes associated with that commit (getChanges
). - Extract the filenames from each change and collect them all into a single list.
Through experimentation on nonprod instance of Bitbucket, we discovered that while getCommitsBetween
does return the correct list of commits, getChanges
does not return any changes for those commits. I was not able to reproduce this locally on a fresh instance of Bitbucket.
The main question I wanted to ask is whether you had any thoughts on why Bitbucket’s CommitService
would produce the wrong result for getChanges
in this context? We confirmed via the UI that the commits in question did actually have changes associated with them, so I couldn’t work out why the result of getChanges
wouldn’t reflect that.