Skip to content

Commit 08f5bf0

Browse files
committed
Add timestamp of the commit as event register flag
Signed-off-by: khanhtc1202 <[email protected]>
1 parent c52ff8c commit 08f5bf0

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

pkg/app/pipectl/cmd/event/register.go

+17-14
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ type register struct {
3737
contexts map[string]string
3838

3939
// information of commit that triggers the event
40-
commitHash string
41-
commitTitle string
42-
commitMessage string
43-
commitURL string
44-
commitAuthor string
40+
commitHash string
41+
commitTitle string
42+
commitMessage string
43+
commitURL string
44+
commitAuthor string
45+
commitTimestamp int64
4546
}
4647

4748
func newRegisterCommand(root *command) *cobra.Command {
@@ -64,6 +65,7 @@ func newRegisterCommand(root *command) *cobra.Command {
6465
cmd.Flags().StringVar(&r.commitMessage, "commit-message", r.commitMessage, "The message of commit that triggers the event.")
6566
cmd.Flags().StringVar(&r.commitURL, "commit-url", r.commitURL, "The URL of commit that triggers the event.")
6667
cmd.Flags().StringVar(&r.commitAuthor, "commit-author", r.commitAuthor, "The author of commit that triggers the event.")
68+
cmd.Flags().Int64Var(&r.commitTimestamp, "commit-timestamp", r.commitTimestamp, "The timestamp of commit that triggers the event.")
6769

6870
cmd.MarkFlagRequired("name")
6971
cmd.MarkFlagRequired("data")
@@ -83,15 +85,16 @@ func (r *register) run(ctx context.Context, input cli.Input) error {
8385
defer cli.Close()
8486

8587
req := &apiservice.RegisterEventRequest{
86-
Name: r.name,
87-
Data: r.data,
88-
Labels: r.labels,
89-
Contexts: r.contexts,
90-
CommitHash: r.commitHash,
91-
CommitTitle: r.commitTitle,
92-
CommitMessage: r.commitMessage,
93-
CommitUrl: r.commitURL,
94-
CommitAuthor: r.commitAuthor,
88+
Name: r.name,
89+
Data: r.data,
90+
Labels: r.labels,
91+
Contexts: r.contexts,
92+
CommitHash: r.commitHash,
93+
CommitTitle: r.commitTitle,
94+
CommitMessage: r.commitMessage,
95+
CommitUrl: r.commitURL,
96+
CommitAuthor: r.commitAuthor,
97+
CommitTimestamp: r.commitTimestamp,
9598
}
9699

97100
res, err := cli.RegisterEvent(ctx, req)

0 commit comments

Comments
 (0)