-
-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance pipeline message and pr title #3421
Draft
6543
wants to merge
37
commits into
woodpecker-ci:main
Choose a base branch
from
6543-forks:actually-use-title
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+310
−268
Draft
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
9b85108
Update pipeline list UI
anbraten 79df566
Merge remote-tracking branch 'upstream/main' into update-pipeline-list
anbraten 9bfd2f3
gitea parse email too
6543 d07b161
example how tests should be
6543 fb627db
fix similar bugs
6543 0cf1fb6
tests tests tests
6543 9a9231b
Merge branch 'main' into gitea-parse-mail-too
6543 55441bf
move old tests to new tests
6543 2b4e136
tags dont have branch info
6543 7165ef5
extend tests and finish migration
6543 c691b31
fix
6543 7db9650
actually differ between title and message and use it propperly
6543 d1f49c0
refactor
6543 7f23b07
update tests etc...
6543 f25b7b0
fix test
6543 ada1819
dont forget the gitlab
6543 3812c62
bitbucket
6543 b0d5168
Merge branch 'main' into actually-use-title
6543 114ba6a
Merge branch 'main' into actually-use-title
6543 59086fe
Merge branch 'main' into actually-use-title
6543 9df94d8
Merge branch 'main' into actually-use-title2
6543 7344a90
Merge remote-tracking branch 'upstream/main' into update-pipeline-list
anbraten 36cf5af
adjust pipeline item
anbraten a0960bb
Merge branch 'update-pipeline-list' into pr/6543/3421-1
anbraten f89f4e8
Merge branch 'main' into actually-use-title
anbraten ba83f48
Merge branch 'main' into actually-use-title
6543 acc52fc
Merge remote-tracking branch 'upstream/main' into pr/6543/3421
anbraten 756f9ea
Merge branch 'actually-use-title' of github.com:6543-forks/woodpecker…
anbraten 39d5350
adjust pipeline message and title
anbraten 87946fa
adjust ui text
anbraten 651663c
adjust to proper values
anbraten fbc586e
Merge branch 'main' into actually-use-title
6543 020aa18
Merge remote-tracking branch 'upstream/main' into pr/6543/3421
anbraten 6c12da1
Merge branch 'actually-use-title' of github.com:6543-forks/woodpecker…
anbraten 168b1eb
Merge remote-tracking branch 'upstream/main' into pr/6543/3421
anbraten 5f9c57c
Merge branch 'main' into actually-use-title
qwerty287 c6a8677
Merge branch 'main' into actually-use-title
6543 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,12 +128,21 @@ func pipelineFromTag(hook *pushHook) *model.Pipeline { | |
) | ||
ref := strings.TrimPrefix(hook.Ref, "refs/tags/") | ||
|
||
var message string | ||
if len(hook.Commits) > 0 { | ||
message = hook.Commits[0].Message | ||
if len(hook.Commits) == 1 { | ||
} | ||
} else { | ||
message = hook.HeadCommit.Message | ||
} | ||
|
||
return &model.Pipeline{ | ||
Event: model.EventTag, | ||
Commit: hook.Sha, | ||
Ref: fmt.Sprintf("refs/tags/%s", ref), | ||
ForgeURL: fmt.Sprintf("%s/src/tag/%s", hook.Repo.HTMLURL, ref), | ||
Message: fmt.Sprintf("created tag %s", ref), | ||
Message: message, | ||
Avatar: avatar, | ||
Author: hook.Sender.UserName, | ||
Sender: hook.Sender.UserName, | ||
|
@@ -155,17 +164,17 @@ func pipelineFromPullRequest(hook *pullRequestHook) *model.Pipeline { | |
} | ||
|
||
pipeline := &model.Pipeline{ | ||
Event: event, | ||
Commit: hook.PullRequest.Head.Sha, | ||
ForgeURL: hook.PullRequest.HTMLURL, | ||
Ref: fmt.Sprintf("refs/pull/%d/head", hook.Number), | ||
Branch: hook.PullRequest.Base.Ref, | ||
Message: hook.PullRequest.Title, | ||
Author: hook.PullRequest.Poster.UserName, | ||
Avatar: avatar, | ||
Sender: hook.Sender.UserName, | ||
Email: hook.Sender.Email, | ||
Title: hook.PullRequest.Title, | ||
Event: event, | ||
Commit: hook.PullRequest.Head.Sha, | ||
ForgeURL: hook.PullRequest.HTMLURL, | ||
Ref: fmt.Sprintf("refs/pull/%d/head", hook.Number), | ||
Branch: hook.PullRequest.Base.Ref, | ||
Author: hook.PullRequest.Poster.UserName, | ||
Avatar: avatar, | ||
Sender: hook.Sender.UserName, | ||
Email: hook.Sender.Email, | ||
PRTitleDescription: hook.PullRequest.Title + "\n" + hook.PullRequest.Body, | ||
Message: "", // TODO: get message from last commit to pr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does someone know if we can this data from the webhook somehow, or do we need to query the api again? |
||
Refspec: fmt.Sprintf("%s:%s", | ||
hook.PullRequest.Head.Ref, | ||
hook.PullRequest.Base.Ref, | ||
|
@@ -187,7 +196,7 @@ func pipelineFromRelease(hook *releaseHook) *model.Pipeline { | |
Ref: fmt.Sprintf("refs/tags/%s", hook.Release.TagName), | ||
ForgeURL: hook.Release.HTMLURL, | ||
Branch: hook.Release.Target, | ||
Message: fmt.Sprintf("created release %s", hook.Release.Title), | ||
Message: hook.Release.Title + "\n" + hook.Release.Note, | ||
Avatar: avatar, | ||
Author: hook.Sender.UserName, | ||
Sender: hook.Sender.UserName, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,19 +204,19 @@ func TestForgejoParser(t *testing.T) { | |
}, | ||
}, | ||
pipe: &model.Pipeline{ | ||
Author: "gordon", | ||
Event: "pull_request", | ||
Commit: "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", | ||
Branch: "main", | ||
Ref: "refs/pull/1/head", | ||
Refspec: "feature/changes:main", | ||
Title: "Update the README with new information", | ||
Message: "Update the README with new information", | ||
Sender: "gordon", | ||
Avatar: "http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", | ||
Email: "[email protected]", | ||
ForgeURL: "http://forgejo.golang.org/gordon/hello-world/pull/1", | ||
PullRequestLabels: []string{}, | ||
Author: "gordon", | ||
Event: "pull_request", | ||
Commit: "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", | ||
Branch: "main", | ||
Ref: "refs/pull/1/head", | ||
Refspec: "feature/changes:main", | ||
PRTitleDescription: "Update the README with new information", | ||
Message: "Update the README with new information", | ||
Sender: "gordon", | ||
Avatar: "http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", | ||
Email: "[email protected]", | ||
ForgeURL: "http://forgejo.golang.org/gordon/hello-world/pull/1", | ||
PullRequestLabels: []string{}, | ||
}, | ||
}, | ||
{ | ||
|
@@ -243,18 +243,18 @@ func TestForgejoParser(t *testing.T) { | |
}, | ||
}, | ||
pipe: &model.Pipeline{ | ||
Author: "test", | ||
Event: "pull_request", | ||
Commit: "788ed8d02d3b7fcfcf6386dbcbca696aa1d4dc25", | ||
Branch: "main", | ||
Ref: "refs/pull/2/head", | ||
Refspec: "test-patch-1:main", | ||
Title: "New Pull", | ||
Message: "New Pull", | ||
Sender: "test", | ||
Avatar: "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", | ||
Email: "[email protected]", | ||
ForgeURL: "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2", | ||
Author: "test", | ||
Event: "pull_request", | ||
Commit: "788ed8d02d3b7fcfcf6386dbcbca696aa1d4dc25", | ||
Branch: "main", | ||
Ref: "refs/pull/2/head", | ||
Refspec: "test-patch-1:main", | ||
PRTitleDescription: "New Pull", | ||
Message: "New Pull", | ||
Sender: "test", | ||
Avatar: "http://127.0.0.1:3000/avatars/dd46a756faad4727fb679320751f6dea", | ||
Email: "[email protected]", | ||
ForgeURL: "http://127.0.0.1:3000/Test-CI/multi-line-secrets/pulls/2", | ||
PullRequestLabels: []string{ | ||
"Kind/Bug", | ||
"Kind/Security", | ||
|
@@ -284,19 +284,19 @@ func TestForgejoParser(t *testing.T) { | |
}, | ||
}, | ||
pipe: &model.Pipeline{ | ||
Author: "anbraten", | ||
Event: "pull_request_closed", | ||
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", | ||
Branch: "main", | ||
Ref: "refs/pull/1/head", | ||
Refspec: "anbraten-patch-1:main", | ||
Title: "Adjust file", | ||
Message: "Adjust file", | ||
Sender: "anbraten", | ||
Avatar: "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", | ||
Email: "[email protected]", | ||
ForgeURL: "https://forgejo.com/anbraten/test-repo/pulls/1", | ||
PullRequestLabels: []string{}, | ||
Author: "anbraten", | ||
Event: "pull_request_closed", | ||
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", | ||
Branch: "main", | ||
Ref: "refs/pull/1/head", | ||
Refspec: "anbraten-patch-1:main", | ||
PRTitleDescription: "Adjust file", | ||
Message: "Adjust file", | ||
Sender: "anbraten", | ||
Avatar: "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", | ||
Email: "[email protected]", | ||
ForgeURL: "https://forgejo.com/anbraten/test-repo/pulls/1", | ||
PullRequestLabels: []string{}, | ||
}, | ||
}, | ||
{ | ||
|
@@ -322,19 +322,19 @@ func TestForgejoParser(t *testing.T) { | |
}, | ||
}, | ||
pipe: &model.Pipeline{ | ||
Author: "anbraten", | ||
Event: "pull_request_closed", | ||
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", | ||
Branch: "main", | ||
Ref: "refs/pull/1/head", | ||
Refspec: "anbraten-patch-1:main", | ||
Title: "Adjust file", | ||
Message: "Adjust file", | ||
Sender: "anbraten", | ||
Avatar: "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", | ||
Email: "[email protected]", | ||
ForgeURL: "https://forgejo.com/anbraten/test-repo/pulls/1", | ||
PullRequestLabels: []string{}, | ||
Author: "anbraten", | ||
Event: "pull_request_closed", | ||
Commit: "d555a5dd07f4d0148a58d4686ec381502ae6a2d4", | ||
Branch: "main", | ||
Ref: "refs/pull/1/head", | ||
Refspec: "anbraten-patch-1:main", | ||
PRTitleDescription: "Adjust file", | ||
Message: "Adjust file", | ||
Sender: "anbraten", | ||
Avatar: "https://seccdn.libravatar.org/avatar/fc9b6fe77c6b732a02925a62a81f05a0?d=identicon", | ||
Email: "[email protected]", | ||
ForgeURL: "https://forgejo.com/anbraten/test-repo/pulls/1", | ||
PullRequestLabels: []string{}, | ||
}, | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty if