Drone

Gitlab push with multiple commits (wrong information)

When gitlab triggers drone via the webhook with multiple commits the message gets wrong.
Here’s an example of an incoming webhook:

{
  ...
  "commits": [
    {
      "id": "8c1107102080db6dbfc81adc9fcebddaff73c446",
      "message": "Merge branch 'develop' into 'REDACTED'\n\nDevelop\n\nSee merge request REDACTED",
      "timestamp": "2019-10-08T15:08:32Z",
      "url": "http://REDACTED/commit/8c1107102080db6dbfc81adc9fcebddaff73c446",
      "author": {
        "name": "Marco Santos",
        "email": "REDACTED"
      },
      "added": [
        ...
      ],
      "modified": [
        ...
      ],
      "removed": [

      ]
    },
    {
      "id": "85ca066d823d3e572fc706b8ca1ae5b8c980f1a4",
      "message": "Merge branch 'develop' into 'REDACTED'\n\nDevelop\n\nSee merge request REDACTED",
      "timestamp": "2019-10-10T16:26:51Z",
      "url": "http://REDACTED/commit/85ca066d823d3e572fc706b8ca1ae5b8c980f1a4",
      "author": {
        "name": "Marco Santos",
        "email": "REDACTED"
      },
      "added": [
        ...
      ],
      "modified": [
        ...
      ],
      "removed": [
        ...
      ]
    },
    {
      "id": "f5959a562efd643152303377fd0ed89b34f2452a",
      "message": "REDACTED\n",
      "timestamp": "2019-10-23T14:58:38Z",
      "url": "http://REDACTED/commit/f5959a562efd643152303377fd0ed89b34f2452a",
      "author": {
        "name": "REDACTED",
        "email": "REDACTED"
      },
      "added": [
      	...
      ],
      "modified": [
        ...
      ],
      "removed": [

      ]
    },
    {
      "id": "568299b5fc8d63c96d6401a551c14d3017adae82",
      "message": "Merge branch 'REDACTED' into 'REDACTED'\n\nREDACTED\n\nSee merge request REDACTED",
      "timestamp": "2019-10-23T15:15:45Z",
      "url": "http://REDACTED/commit/568299b5fc8d63c96d6401a551c14d3017adae82",
      "author": {
        "name": "Marco Santos",
        "email": "REDACTED"
      },
      "added": [

      ],
      "modified": [
        ...
      ],
      "removed": [

      ]
    },
    {
      "id": "a09757196b130e6a744b296ec0c2d809ddaf1228",
      "message": "fix bug in REDACTED\n",
      "timestamp": "2019-10-29T15:00:28Z",
      "url": "http://REDACTED/commit/a09757196b130e6a744b296ec0c2d809ddaf1228",
      "author": {
        "name": "REDACTED",
        "email": "REDACTED"
      },
      "added": [

      ],
      "modified": [
        ...
      ],
      "removed": [

      ]
    }
  ],
  "total_commits_count": 5,
  ...
}

This is the latest commits on the project in Gitlab
alt text

The project on Drone
alt text

The commit is arriving with the right user, sha … But not the Message and URL.

According to the file: https://github.com/drone/go-scm/blob/master/scm/driver/gitlab/webhook.go (line 144)

if len(src.Commits) > 0 {
	dst.Commit.Message = src.Commits[0].Message
	dst.Commit.Link = src.Commits[0].URL
}

This issue is open on the repository at the following url: https://github.com/drone/go-scm/issues/45