Skip to content
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

add merged at for git pullrequest struct #565

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yuzp1996
Copy link
Contributor

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • spec PR link included
  • Follows the commit message standard
  • Meets the contributing guidelines (including
    functionality, content, code)
  • Test cases with documentation and functionality works as expected using current and related github repos (MUST deploy and check)
  • Release notes block below has been filled in or deleted (only if no user facing changes)

Release Notes

@yuzp1996 yuzp1996 force-pushed the feat/notifact-wrong-pr-author branch 2 times, most recently from 46a735e to 9df87c3 Compare March 29, 2024 04:37
@@ -155,4 +155,7 @@ type BuildGitPullRequestStatus struct {
HasConflicts bool `json:"hasConflicts" variable:"example=false"`
// MergedBy indicates pr was merged by user use email
MergedBy GitUserBaseInfo `json:"mergedBy,omitempty" variable:"[email protected]"`
// +optional
// MergedAt indicates when the pr was merged
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional挪到第二行?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加了这个字短那些生产变量函数也需要改?

@yuzp1996 yuzp1996 force-pushed the feat/notifact-wrong-pr-author branch 3 times, most recently from 4559721 to 3af42ad Compare March 31, 2024 08:38
@yuzp1996 yuzp1996 force-pushed the feat/notifact-wrong-pr-author branch from 3af42ad to d02551b Compare March 31, 2024 08:48
@@ -154,5 +154,7 @@ type BuildGitPullRequestStatus struct {
// +optional
HasConflicts bool `json:"hasConflicts" variable:"example=false"`
// MergedBy indicates pr was merged by user use email
MergedBy GitUserBaseInfo `json:"mergedBy,omitempty" variable:"[email protected]"`
MergedBy GitUserBaseInfoWithoutVariable `json:"mergedBy,omitempty" variable:"-"`
Copy link
Contributor Author

@yuzp1996 yuzp1996 Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge 相关的数据 mergedBy mergedAt 目前不适合作为参数存在

PR 触发的时候,不会有 PR merge 的信息
PR 合并的时候 此时也不会触发 PR 的构建
因此产品中即使提供了这几个参数,也永远用不到

目前 merge 的信息只有在 lastCommit 相关的 PR 中会用到,但是他们不会被转成变量

所以这里把 merge 相关的两个参数 mergedBy mergedAt 的 variable 都去掉了

另外之前添加的 mergedBy 参数,没有增加对应的变量函数,算是一个 bug,这里也正好处理掉了

}

// GitUserBaseInfoWithoutVariable user base info without variable
type GitUserBaseInfoWithoutVariable struct {
Copy link
Contributor Author

@yuzp1996 yuzp1996 Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前只有当 variable 为 “-” 时不会作为变量展示,所以新增了一个结构体 GitUserBaseInfoWithoutVariable,和 GitUserBaseInfo 结构一样,只不过 variable 都为 "-"

我还考虑过修改参数的处理逻辑,当 root 节点 variable 为 ”-“ 时,不处理 root 节点下子节点的参数,但是看起来不太通用,覆盖的场景更少,因此选择当前的办法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants