From 3d832a3f950e9c60b6036bcca58900b65631dcc2 Mon Sep 17 00:00:00 2001 From: nobe4 Date: Wed, 2 Oct 2024 21:05:52 +0200 Subject: [PATCH] docs(actions): fix docs for new action --- cmd/gen-docs/main.go | 7 ++++--- internal/actions/done/done.go | 1 + internal/actions/hide/hide.go | 1 + internal/actions/read/read.go | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/gen-docs/main.go b/cmd/gen-docs/main.go index 2f36fb9..e0856c5 100644 --- a/cmd/gen-docs/main.go +++ b/cmd/gen-docs/main.go @@ -22,6 +22,7 @@ func main() { if info.IsDir() || filepath.Ext(path) != ".go" || + strings.HasSuffix(path, "_test.go") || filepath.Base(path) == "actions.go" { return nil } @@ -64,9 +65,9 @@ func format(content string) (string, error) { } header := strings.Trim(parts[0], "\n") - parts = strings.SplitN(header, "\n", 2) + parts = strings.SplitN(header, "\n\n", 2) - re := regexp.MustCompile(`Package (\w+) implements an \[actions.Runner\] that (.*)\.`) + re := regexp.MustCompile(`Package (\w+) implements an \[actions.Runner\] that (.*\n?.*)\.`) matches := re.FindStringSubmatch(parts[0]) if len(matches) < 3 { @@ -83,7 +84,7 @@ func format(content string) (string, error) { outParts = append(outParts, tail) } - return strings.Join(outParts, "\n"), nil + return strings.Join(outParts, "\n\n"), nil } func indent(s string) string { diff --git a/internal/actions/done/done.go b/internal/actions/done/done.go index 7e6a240..c86c97c 100644 --- a/internal/actions/done/done.go +++ b/internal/actions/done/done.go @@ -1,5 +1,6 @@ /* Package done implements an [actions.Runner] that marks a notification as done. + It updates Meta.Done and marks the notification's thread as done on GitHub. The notification will be hidden until the thread is updated. Ref: https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-done diff --git a/internal/actions/hide/hide.go b/internal/actions/hide/hide.go index 1982647..8e49577 100644 --- a/internal/actions/hide/hide.go +++ b/internal/actions/hide/hide.go @@ -1,5 +1,6 @@ /* Package hide implements an [actions.Runner] that hides a notification. + It hides the notifications completely. */ package hide diff --git a/internal/actions/read/read.go b/internal/actions/read/read.go index e88f425..95265fd 100644 --- a/internal/actions/read/read.go +++ b/internal/actions/read/read.go @@ -1,5 +1,6 @@ /* Package read implements an [actions.Runner] that marks a notification as read. + It updates Unread and marks the notification's thread as read on GitHub. Ref: https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-read */