DRONE_COMMIT_MESSAGE should not include a trailing newline

The variable DRONE_COMMIT_MESSAGE has a trailing newline. This is not desirable for commands and can sometimes interfere with parsing.

For example, with a commit message of Test message, the following command line in drone.yml

- if ! echo ${DRONE_COMMIT_MESSAGE} | grep -q ...

…gets expanded as

+ if ! echo "Test message\n" | grep -q ...

If the commit message contains colons, then this example will throw off the yaml parser. Of course, the whole line could be wrapped in quotes, but if it is generated from Starlark with drone starlark, then quotes are not added automatically. It would be best to remove the trailing newline from DRONE_COMMIT_MESSAGE.

I ran a quick test using the below yaml:

kind: pipeline
type: docker
name: default

  - name: test1
    image: alpine
    pull: if-not-exists
    - echo "${DRONE_COMMIT_MESSAGE}"

and there was no newline in the build output [1]

+ echo "test commit message"
test commit message

The commit message comes from webhooks delivered by your source control management system (e.g. github, gitlab, gitea). If you are seeing a newline appended to your commit message it is likely being added by your source control management system, not by Drone. For example, if you look at a real-world gitea payload [2] you will see that gitea appends a newline to commit message (if this is undesirable, you would need to raise an issue with the gitea team). If you look at a real-world github payload [3] you will see there is no trailing newline.

[1] https://cloud.drone.io/drone/hello-world/216/1/2
[2] https://github.com/drone/go-scm/blob/master/scm/driver/gitea/testdata/webhooks/push.json#L9
[3] https://github.com/drone/go-scm/blob/master/scm/driver/github/testdata/webhooks/push.json#L15