porting all github actions from bluesky-social/indigo to tangled CI

beemo: config arg to require min words to notify

Changed files
+16
cmd
+6
cmd/beemo/main.go
··· 106 106 Required: true, 107 107 EnvVars: []string{"BEEMO_MENTION_DIDS"}, 108 108 }, 109 + &cli.IntFlag{ 110 + Name: "minimum-words", 111 + Usage: "minimum length of post text (word count; zero for no minimum)", 112 + Value: 0, 113 + EnvVars: []string{"BEEMO_MINIMUM_WORDS"}, 114 + }, 109 115 }, 110 116 }, 111 117 }
+10
cmd/beemo/notify_mentions.go
··· 19 19 mentionDIDs []syntax.DID 20 20 logger *slog.Logger 21 21 directory identity.Directory 22 + minimumWords int 22 23 } 23 24 24 25 func (mc *MentionChecker) ProcessPost(ctx context.Context, did syntax.DID, rkey syntax.RecordKey, post appbsky.FeedPost) error { 25 26 mc.logger.Debug("processing post record", "did", did, "rkey", rkey) 27 + 28 + if mc.minimumWords > 0 { 29 + words := strings.Split(post.Text, " ") 30 + if len(words) < mc.minimumWords { 31 + return nil 32 + } 33 + } 26 34 27 35 for _, facet := range post.Facets { 28 36 for _, feature := range facet.Features { ··· 57 65 ctx := context.Background() 58 66 logger := configLogger(cctx, os.Stdout) 59 67 relayHost := cctx.String("relay-host") 68 + minimumWords := cctx.Int("minimum-words") 60 69 61 70 mentionDIDs := []syntax.DID{} 62 71 for _, raw := range strings.Split(cctx.String("mention-dids"), ",") { ··· 72 81 mentionDIDs: mentionDIDs, 73 82 logger: logger, 74 83 directory: identity.DefaultDirectory(), 84 + minimumWords: minimumWords, 75 85 } 76 86 77 87 logger.Info("beemo mention checker starting up...", "relayHost", relayHost, "mentionDIDs", mentionDIDs)