From 8abe1e7981b648f1254144bdca96e831676ef3d8 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 11 Feb 2024 14:03:03 -0500 Subject: [PATCH] feat: add convertCommitFile --- api/convert.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/api/convert.go b/api/convert.go index 3f42341..b5da35f 100644 --- a/api/convert.go +++ b/api/convert.go @@ -196,6 +196,23 @@ func convertLabel(label *structs.Label) *github.Label { } } +func convertCommitFile(file *structs.ChangedFile) *github.CommitFile { + if file == nil { + return &github.CommitFile{} + } + + return &github.CommitFile{ + Filename: stringPtr(file.Filename), + PreviousFilename: stringPtr(file.PreviousFilename), + Additions: intPtr(file.Additions), + Deletions: intPtr(file.Deletions), + Changes: intPtr(file.Changes), + Status: stringPtr(file.Status), + BlobURL: stringPtr(file.ContentsURL), + RawURL: stringPtr(file.RawURL), + } +} + func translatePrAction(action structs.HookIssueAction) string { translatedAction := ""