Merge pull request #7 from hanjunlee/feature/pull-request-title

feat: add a new environment for the title of PR.
pull/11/head
Brad Rydzewski 3 years ago committed by GitHub
commit 95828f4a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -175,6 +175,7 @@ func Build(build *drone.Build) map[string]string {
} }
if build.Event == drone.EventPullRequest { if build.Event == drone.EventPullRequest {
env["DRONE_PULL_REQUEST"] = re.FindString(build.Ref) env["DRONE_PULL_REQUEST"] = re.FindString(build.Ref)
env["DRONE_PULL_REQUEST_TITLE"] = build.Title
} }
if strings.HasPrefix(build.Ref, "refs/tags/") { if strings.HasPrefix(build.Ref, "refs/tags/") {
tag := strings.TrimPrefix(build.Ref, "refs/tags/") tag := strings.TrimPrefix(build.Ref, "refs/tags/")

@ -64,6 +64,7 @@ func TestBuild(t *testing.T) {
Before: "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", Before: "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
Ref: "refs/pull/32/head", Ref: "refs/pull/32/head",
Link: "https://github.com/octocat/Hello-World/commit/762941318ee16e59dabbacb1b4049eec22f0d303", Link: "https://github.com/octocat/Hello-World/commit/762941318ee16e59dabbacb1b4049eec22f0d303",
Title: "feat: update README",
Message: "updated README", Message: "updated README",
Author: "octocat", Author: "octocat",
AuthorAvatar: "https://avatars0.githubusercontent.com/u/583231", AuthorAvatar: "https://avatars0.githubusercontent.com/u/583231",
@ -122,6 +123,7 @@ func TestBuild(t *testing.T) {
"DRONE_DEPLOY_ID": "235634642", "DRONE_DEPLOY_ID": "235634642",
"DRONE_FAILED_STAGES": "frontend", "DRONE_FAILED_STAGES": "frontend",
"DRONE_PULL_REQUEST": "32", "DRONE_PULL_REQUEST": "32",
"DRONE_PULL_REQUEST_TITLE": "feat: update README",
"DRONE_SOURCE_BRANCH": "develop", "DRONE_SOURCE_BRANCH": "develop",
"DRONE_TARGET_BRANCH": "master", "DRONE_TARGET_BRANCH": "master",

Loading…
Cancel
Save