Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
Bluesky support (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwojcik authored Sep 17, 2023
1 parent 5324c52 commit b72feab
Show file tree
Hide file tree
Showing 10 changed files with 1,435 additions and 1,006 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Supported platforms:
- Twitter
- Slack
- Discord
- Bluesky

This GitHub Action is heavily inspired by [Any Feed to Mastodon GitHub Action](https://github.com/nhoizey/github-action-feed-to-mastodon) by [Nicolas Hoizey](https://github.com/nhoizey/github-action-feed-to-mastodon). However, there are significant scope and use case diffences between the two:

Expand Down Expand Up @@ -62,6 +63,13 @@ jobs:
slackEnable: true
slackPostFormat: "New post: {title}\n\n{link}"
slackWebhookUrl: 'DISCORD_WEBHOOK_URL'
# Bluesky settings
blueskyEnable: true
blueskyPostFormat: "New post: {title}\n\n{link}"
blueskyHandle: 'user.bsky.social'
blueskyAppPassword: 'APP_PASSWORD'
blueskyOwnerHandle: 'owner.bsky.social'
bluskyOwnerContact: '[email protected]'
```
Internally, the Action uses [actions/checkout](https://github.com/actions/checkout/) and basic Git features (committing and pushing changes to the repo it's run on) to restore and update the feed cache. This allows the Action to avoid posting duplicates.
Expand Down Expand Up @@ -215,6 +223,17 @@ To obtain a webhook URL follow the steps below:
- `slackPostFormat` - custom Discord message format. Optional. If used, it overrides `customPostFormat` setting
- `slackWebhookUrl` - webhook URL to use for posting. Example: `https://hooks.slack.com/services/123/456`

### Bluesky settings

Posting to Bluesky is done by [easy-bsky-bot-sdk](https://www.npmjs.com/package/easy-bsky-bot-sdk).

- `blueskyEnable` - enables / disables posting to Bluesky. Default: `false`
- `blueskyService` - Bluesky server to communicate with. Default: `bsky.social`
- `blueskyHandle` - Bluesky account used to post
- `blueskyAppPassword` - Bluesky app password. Obtain it from `Settings > App passwords`
- `blueskyOwnerHandle` - your handle as an owner of the posting account. Together with `blueskyOwnerContact`, this information is used in bot's user-agent string, so it will be visible to the server owner (but it won't be displayed publicly)
- `blueskyOwnerContact` - your contact information as an owner of the posting account

## Output

The Action sets the output in a following format of a stringified JSON object:
Expand Down Expand Up @@ -242,7 +261,7 @@ See also [SocialService enum](https://github.com/lwojcik/github-action-feed-to-s
- `notConfigured` - posting to the selected service is enabled, but configuration is incomplete (e.g. missing access key)
- `updated` - new item was detected and the update was posted successfully (for services that don't expose post URLs, e.g. Mastodon metadata or Discord webooks),
- `errored` - new item was detected and the update was posted, but it resulted in an error,
- `skipped` - no new item was detected or posting was skipped for a different reason - see the log for information.
- `skipped` - no new item was detected or posting was skipped for a different reason - see the log for information.

See also [PostSubmitStatus enum](https://github.com/lwojcik/github-action-feed-to-social-media/blob/main/src/types.ts#L61).

Expand Down
24 changes: 23 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,23 @@ inputs:
description: 'Format of the Slack message. Overrides postFormat if used'
slackWebhookUrl:
description: 'Webhook URL to use for posting messages to Slack'

# Bluesky settings
blueskyEnable:
description: 'Enable posting to Bluesky?'
default: 'false'
blueskyPostFormat:
description: 'Format of the Bluesky message. Overrides postFormat if used'
blueskyService:
description: 'Bluesky server URL'
default: 'https://bsky.social'
blueskyHandle:
description: 'Bluesky handle to post to (e.g. myaccount.bsky.social)'
blueskyAppPassword:
description: 'Bluesky app password'
blueskyOwnerHandle:
description: 'Your handle as a bot owner. This info will go in the bot user-agent string, so it will be visible to the server you connect (not displayed publicly)'
blueskyOwnerContact:
description: 'Your contact info as a bot owner. This info will go in the bot user-agent string, so it will be visible to the server you connect (not displayed publicly)'
outputs:
updateStatus:
description: 'Stringified object with update status'
Expand Down Expand Up @@ -116,6 +132,12 @@ runs:
INPUT_DISCORDWEBHOOKURL: ${{ inputs.discordWebhookUrl }}
INPUT_SLACKENABLE: ${{ inputs.slackEnable }}
INPUT_SLACKWEBHOOKURL: ${{ inputs.slackWebhookUrl }}
INPUT_BLUESKYENABLE: ${{ inputs.blueskyEnable }}
INPUT_BLUESKYPOSTFORMAT: ${{ inputs.blueskyPostFormat }}
INPUT_BLUESKYHANDLE: ${{ inputs.blueskyHandle }}
INPUT_BLUESKYAPPPASSWORD: ${{ inputs.blueskyAppPassword }}
INPUT_BLUESKYOWNERHANDLE: ${{ inputs.blueskyOwnerHandle }}
INPUT_BLUESKYOWNERCONTACT: ${{ inputs.blueskyOwnerContact }}

- name: Pull any changes from Git
shell: bash
Expand Down
Loading

0 comments on commit b72feab

Please sign in to comment.