Skip to content

Repository for democratising of Galaxy's social media activity - encourage collaboration, editing, peer-review of toots ๐Ÿ˜ and more

License

Notifications You must be signed in to change notification settings

usegalaxy-eu/galaxy-social

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

72 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Galaxy Social

๐Ÿ‘‡
Create new post

How to Create a Post

To create a post on Galaxy Social, follow these steps:

  1. Create a Branch: Begin by creating a branch in this repository or your forked repository.

  2. Add a New File: Within the "posts" folder (or sub-folders), create a new file with the extension ".md" and commit it to your branch.

  3. Use the Post Template: Utilize the following template for the post content:

---
media:
  - bluesky
  - mastodon
  - matrix
  - slack

mentions:
  bluesky:
    - a.bsky.social
  mastodon:
    - a
  matrix:
    - a:matrix.org

hashtags:
  bluesky:
    - a
    - b
  mastodon:
    - c
    - d
---
Your text content goes here.

![A](https://example.com/a.jpg)
![B](https://example.org/b.png)

Notes on the Template:

  • Everything between the two --- are metatags and should be in YAML format.

  • "media" (Required): Ensure the media name is implemented inside the plugins.yml.

  • "mentions" and "hashtags" (Optional): Follow the specified format as shown in the template.

  • "Your text content goes here." (Required): This is the content that will be posted to social media platforms. When the character limit is reached on a social media, it will be divided into several posts as a thread. Note that some social media platforms do not support Markdown formatting, so use plain text only.

  • "images" (Optional): You can include images using Markdown format at the end of the file like this: ![Alternative text](Link to the image). Alternatively, you can simply drag and drop an image from your PC while adding your file.

  1. Create a Pull Request: Once your post is ready, create a pull request to the main branch from another branch or from your fork

  2. Preview and Review: After each pull request, the "Create Preview" GitHub action will run. It will preview the content as a comment to the pull request and highlight any errors that need to be fixed before merging.

  3. Publish Your Content: Upon merging the pull request, the "Publish Content" GitHub action will run. The results will be added to processed_files.json in the processed_files branch.

By following these steps, you can effectively create and publish posts on Galaxy Social.

Add a New Social Media Platform

Expanding the capabilities of Galaxy Social by adding a new social media platform is a straightforward process. Follow these steps to integrate a new platform:

  1. Create a Plugin File: Begin by adding a Python file to the lib/plugins folder. This file should contain a class with a function named create_post(content, mentions, hashtags, images, alt_texts). This function will handle the process of sending announcements to the desired social media platform.

  2. Update plugins.yml: Next, update the plugins.yml file to include the new social media platform. Follow this template:

  - name: name_of_the_media 
    class: file_name.class_name
    enabled: true
    config:
      token: $TOKEN_SAVED_IN_PUBLISH_CONTENT
      room_id: "room_id"

Ensure to replace name_of_the_media with the name of the new platform, and file_name.class_name with the appropriate file and class name for the plugin. The name is then used in the media tag in the post file (posts/*.md) to determine the social media.

  1. Configuration: In the config section, specify any required variables for initializing the plugin class. This may include authentication tokens, room IDs, or other platform-specific parameters. Any configuration that needs to be securely passed with GitHub secrets should be prefixed with $ in order to be easily identifiable within the workflow YAML file.

  2. GitHub Secrets: Add any tokens or variables required for the plugin to GitHub secrets. This ensures sensitive information is securely stored. Refer to GitHub secrets documentation for guidance on creating secrets.

  3. Enable the Plugin: Simply set enabled: true to enable the new social media platform. This ensures that it will be implemented when creating posts.

  4. Update publish_content.yml: Finally, update the publish_content.yml file to include an environment variable referencing the token saved in GitHub secrets. Use the following template: (Don't put the prefixed $ in here)

...
env:
  TOKEN_SAVED_IN_PUBLISH_CONTENT: ${{ secrets.TOKEN_SAVED_IN_GITHUB_SECRETS }}
...

Replace TOKEN_SAVED_IN_GITHUB_SECRETS with the name of the secret containing the token for the new social media platform.

By following these steps, you can seamlessly integrate a new social media platform into Galaxy Social, expanding its reach and functionality.

Duplicate a Social Media Platform with Different Token

If you need to use the same social media platform with different authentication tokens, you can duplicate the entry in the plugins.yml file. Follow these steps:

  1. Duplicate Entry: Copy the entry for the social media platform in the plugins.yml file and paste it below the original entry.

  2. Update Name and Tokens: Change the name of the duplicated entry to reflect the new configuration, and replace the token with the new authentication token.

  3. Configuration: Adjust any other configuration parameters as needed for the duplicated entry.

  4. Use Name in Post: Remember that the name you specify in the plugins.yml file must also be used within the media tag when creating a post. Ensure consistency to link the post with the correct social media platform.

By following these steps, you can effectively duplicate a social media platform with a different token for specific use cases or configurations.

Run locally

You can execute this repository on your machine by running lib/galaxy_social.py with the argument --files Files ... or --folder FOLDER to process files, or add --preview to preview the file as markdown. Also there is --json-out processed_files.json that could be change where to save the json results output.

Remember to add the env variable that needed for each social media seperatly.

Social media implemented

  • Bluesky
  • Mastodon
  • Matrix: hashtags and alt_text for image are not working!
  • Slack: mentions and hashtags are not working!
  • Linkedin: not implemented but the first draft of python file is in the plugins.

About

Repository for democratising of Galaxy's social media activity - encourage collaboration, editing, peer-review of toots ๐Ÿ˜ and more

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages