Giter VIP home page Giter VIP logo

bsky-bot-r's Introduction

Build your own Bluesky bot with R!

This is a super barebones skeleton example of how to use GitHub actions to run an R script that posts content to Bluesky.

A few important notes:

  • You need to create a Bluesky app password at https://bsky.app/settings/app-passwords

  • If you’re running this locally, create a file named .Renviron and put this in there:

    BSKY_USER="@your-bluesky-username"
    BSKY_PASS="APP-SPECIFIC-PASSWORD"
  • Add these environment variables to your GitHub repository by going to Settings > Secrets and variables > Actions and creating two new respository secrets with your username and password:

  • Right now, .github/workflows/post-to-bsky.yml is configured to only run manually (it uses on: workflow_dispatch), but you can adjust that to follow a cron schedule or occur after pushing a commit or whatever. See this for all the kinds of events you can use. To trigger the action manually, go to Actions > Name of the workflow > Run workflow…

  • That workflow file uses R’s collection of GitHub Actions to install R, install packages from an {renv} lockfile, and run the code. You can make this as fancy as you want (and you should probably add better reporting, and logging, etc.).

  • Right now, script.R connects to the Bluesky API, generates three random numbers, and posts them to Bluesky. It’s super primitive but it works. In real life, you’d want to:

    1. Maybe make a better wrapper around the API
    2. Do something more exciting than generating random numbers. Parse an RSS feed. Generate random text. Post plots or generative artwork. Whatever you want.

    You can make the repository as complex as you want, too. Not everything has to live in script.R—the workflow file right now is set to run just that, but you can change it to whatever.

bsky-bot-r's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.