2

I'm implementing a custom extension in which I need to get the list of commit messages since the previous build in an Azure Devops Pipeline.

Build n (commit n, commit n-1)
Build n-1 (commit n-2, commit n-3)

This answer points at the Build.SourceVersionMessage as a way to get the commit message. I tried it but it only references the last commit commit n, instead of commit n, commit n-1:

          - task: MyTask@0
            inputs:
              commitMessage: '$(Build.SourceVersionMessage)'
import tl = require('azure-pipelines-task-lib/task');

async function run() {
    try {
        const commitMessage = tl.getInput("commitMessage", true) as string
        console.log('commitMessage', commitMessage);
    } catch (err) {
        tl.setResult(tl.TaskResult.Failed, err.message);
    }
}

run();

How can I get all the messages since the previous build?

codependent
  • 23,193
  • 31
  • 166
  • 308
  • 1
    I'm afraid there is no feature that can meet your requirements now. – Walter Apr 27 '21 at 08:53
  • 2
    Thanks for the feedback, I opened a feature request to ask for this improvement: https://developercommunity.visualstudio.com/search?space=21&q=get+list+commit+messages – codependent Apr 27 '21 at 15:54

0 Answers0