diff --git a/README.md b/README.md index 5d31974..c01bf74 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ The following variables are available. You can also look at the [action.yml](act | previous_filename | The previous filename (for manual tesing or running alongside update) | false | unset | | keys | Comma separated list of keys to post (defaults to url) | false | url | | unique | Field to use to determine uniqueness | true | url | -| hashtag | A hashtag to use (defaults to `#Rseng`) | false | #RSEng | +| hashtag | A comma separated list of hashtags to use (defaults to `#RSEng`) | false | #RSEng | | test | Test the updater (ensure there are jobs) | true | false | | deploy | Global deploy across any service set to true? | true | true | | bluesky_deploy | Deploy to BlueSky? | true | false | diff --git a/action.yml b/action.yml index baa4cb0..ba9fbfc 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,7 @@ inputs: required: true default: url hashtag: - description: A hashtag to use (defaults to Rseng) + description: A comma separated list of hashtags to use (defaults to RSEng) required: false default: "#RSEng" test: diff --git a/find-updates.py b/find-updates.py index 202e2e2..260a045 100755 --- a/find-updates.py +++ b/find-updates.py @@ -111,7 +111,7 @@ def get_parser(): "--hashtag", dest="hashtag", default="#RSEng", - help="A hashtag (starting with #) to include in the post, defaults to #RSEng", + help="A comma separated list of hashtags (starting with #) to include in the post, defaults to #RSEng", ) update.add_argument( @@ -282,7 +282,7 @@ def deploy_slack(webhook, message): ) -def deploy_bluesky(client, entry, keys, hashtag): +def deploy_bluesky(client, entry, keys, hashtags): """ Deploy to bluesky. We add the job link separately. """ @@ -291,11 +291,12 @@ def deploy_bluesky(client, entry, keys, hashtag): # Prepare the post, but without the url post = prepare_post(entry, keys, without_url=True) choice = random.choice(icons) - message = f"New {hashtag} Job! {choice}\n" - print(message) - # Add the text to the textbuilder - tb.text(message) + # seems like a clumsy way to build such a message... + tb.text("New ") + for hashtag in hashtags: + tb.tag(hashtag, hashtag.lstrip("#")).text(" ") + tb.text(f"Job! {choice}\n") anchor=entry.get('title') or entry.get('name') or entry.get('url') tb.link(anchor, entry.get('url')) tb.text("\n" + post) @@ -370,6 +371,9 @@ def help(return_code=0): # Parse keys into list keys = [x for x in args.keys.split(",") if x] + # Parse hashtags into list + hashtags = [x for x in args.hashtag.split(",") if x] + # Find new posts in updated previous = set() missing_count = 0 @@ -410,8 +414,8 @@ def help(return_code=0): # Prepare the post post = prepare_post(entry, keys) choice = random.choice(icons) - message = f"New {args.hashtag} Job! {choice}: {post}" - newline_message = f"New {args.hashtag} Job! {choice}\n{post}" + message = f"New {(" ".join(hashtags))} Job! {choice}: {post}" + newline_message = f"New {(" ".join(hashtags))} Job! {choice}\n{post}" print(message) # Convert dates, etc. back to string @@ -435,7 +439,7 @@ def help(return_code=0): deploy_twitter(twitter_client, newline_message) if args.deploy_bluesky and bluesky_client: - deploy_bluesky(bluesky_client, entry, keys, args.hashtag) + deploy_bluesky(bluesky_client, entry, keys, hashtags) # If we are instructed to deploy to mastodon and have a client if args.deploy_mastodon and mastodon_client: