DRONE_COMMIT_MESSAGE on pull request is the first comment instead of the title in gitea

When I open a pull request on a branch in my repository in gitea, a pipeline step is responsible to check if the pull request title is according to the specification. Until now this check was only activated for commits and worked fine by using the $DRONE_COMMIT_MESSAGE variable.

While testing in a separate repository I noticed that the $DRONE_COMMIT_MESSAGE is set to the pull request title, when the PR description is empty. As soon as the PR description is set, the $DRONE_COMMIT_MESSAGE contains the full PR description.

Is there any way to change that behaviour, in order to always receive the PR title in the variable? Or is there any other variable I might have missed, which always has the PR title?

latest: Pulling from library/alpine
Digest: sha256:826f70e0ac33e99a72cf20fb0571245a8fee52d68cb26d8bc58e53bfa65dcdfa
Status: Image is up to date for alpine:latest
+ echo $CI
true
+ echo $DRONE
true
+ echo $DRONE_BRANCH
master
+ echo $DRONE_BUILD_ACTION
opened
+ echo $DRONE_BUILD_CREATED
1616872493
+ echo $DRONE_BUILD_EVENT
pull_request
+ echo $DRONE_BUILD_FINISHED
1616872495
+ echo $DRONE_BUILD_NUMBER
7
+ echo $DRONE_BUILD_PARENT
0
+ echo $DRONE_BUILD_STARTED
1616872495
+ echo $DRONE_BUILD_STATUS
success
+ echo $DRONE_CALVER

+ echo $DRONE_COMMIT
fdbe6de56402b004e38ebb473f5c0b4522321892
+ echo $DRONE_COMMIT_AFTER
fdbe6de56402b004e38ebb473f5c0b4522321892
+ echo $DRONE_COMMIT_AUTHOR
fgierlinger
+ echo $DRONE_COMMIT_AUTHOR_AVATAR
https://git.example.com/user/avatar/fgierlinger/-1
+ echo $DRONE_COMMIT_AUTHOR_EMAIL
fgierlinger@example.com
+ echo $DRONE_COMMIT_AUTHOR_NAME

+ echo $DRONE_COMMIT_BEFORE

+ echo $DRONE_COMMIT_BRANCH
master
+ echo $DRONE_COMMIT_LINK
https://git.example.com/fgierlinger/drone-test/pulls/4
+ echo $DRONE_COMMIT_MESSAGE
my very insightful description
+ echo $DRONE_COMMIT_REF
refs/pull/4/head
+ echo $DRONE_COMMIT_SHA
fdbe6de56402b004e38ebb473f5c0b4522321892
+ echo $DRONE_DEPLOY_TO

+ echo $DRONE_FAILED_STAGES

+ echo $DRONE_FAILED_STEPS

+ echo $DRONE_GIT_HTTP_URL
https://git.example.com/fgierlinger/drone-test.git
+ echo $DRONE_GIT_SSH_URL
git@git.example.com:fgierlinger/drone-test.git
+ echo $DRONE_PULL_REQUEST
4
+ echo $DRONE_REMOTE_URL
https://git.example.com/fgierlinger/drone-test.git
+ echo $DRONE_REPO
fgierlinger/drone-test
+ echo $DRONE_REPO_BRANCH
master
+ echo $DRONE_REPO_LINK
https://git.example.com/fgierlinger/drone-test
+ echo $DRONE_REPO_NAME
drone-test
+ echo $DRONE_REPO_NAMESPACE
fgierlinger
+ echo $DRONE_REPO_OWNER
fgierlinger
+ echo $DRONE_REPO_PRIVATE
true
+ echo $DRONE_REPO_SCM

+ echo $DRONE_REPO_VISIBILITY
private
+ echo $DRONE_SEMVER

+ echo $DRONE_SEMVER_BUILD

+ echo $DRONE_SEMVER_ERROR

+ echo $DRONE_SEMVER_MAJOR

+ echo $DRONE_SEMVER_MINOR

+ echo $DRONE_SEMVER_PATCH

+ echo $DRONE_SEMVER_PRERELEASE

+ echo $DRONE_SEMVER_SHORT

+ echo $DRONE_SOURCE_BRANCH
pr
+ echo $DRONE_STAGE_ARCH
amd64
+ echo $DRONE_STAGE_DEPENDS_ON

+ echo $DRONE_STAGE_FINISHED
1616872495
+ echo $DRONE_STAGE_KIND
pipeline
+ echo $DRONE_STAGE_MACHINE
7b0a0c717eac
+ echo $DRONE_STAGE_NAME
default
+ echo $DRONE_STAGE_NUMBER
1
+ echo $DRONE_STAGE_OS
linux
+ echo $DRONE_STAGE_STARTED
1616872493
+ echo $DRONE_STAGE_STATUS
success
+ echo $DRONE_STAGE_TYPE
docker
+ echo $DRONE_STAGE_VARIANT

+ echo $DRONE_STEP_NAME
echo vars
+ echo $DRONE_STEP_NUMBER
2
+ echo $DRONE_SYSTEM_HOST
drone.example.com
+ echo $DRONE_SYSTEM_HOSTNAME
drone.example.com
+ echo $DRONE_SYSTEM_PROTO
https
+ echo $DRONE_SYSTEM_VERSION
1.10.1
+ echo $DRONE_TAG

+ echo $DRONE_TARGET_BRANCH
master
2 Likes

FYI, I have created the PR for this environment because it seems doesn’t exist.

1 Like