Giter VIP home page Giter VIP logo

autotweet's Introduction

GH Twitter Queue Manager

This little project is the spiritual successor to a similar project I did to automatically update Twitter using an image from a queue that posts to my 365 site and my Twitter feed. This particular feed was to create a simple UI to manage my tweet queue directly on GH without needing any supporting services. This combines the GH API to manage the queue through a Web App and GH Actions to automate the posts to Twitter.

The GUI for the application is in the index.html. The index.html can be hosted anywhere. All the dependencies are included in the index. html file, so move it to a web server and load it in a browser. The first time you run it, you'll need to configure it.

Categories is a comma delimited list of categories.

categories : "Category1, Category2"

Your GH username used to log on.

username:"user"

Your password is a GH Pat Token.

pw : "ghp_abc123"

The repo you wan to hosts this in.

repo : "gh-twitter"

This is the name used on the commits from the apps.

name : "John Doe"

This is the email used on the commits from the apps.

email : "[email protected]"

Also, include a file called tweets.json in the root of the target repo.

[
  {
    "category": "shared",
    "evergreen": false,
    "tweet": "This is my tweet.",
    "guid": "11509dbf-8cbf-4c63-90f7-f6a17927737c"
  },
  {
    "guid": "6eb18a3d-cf2a-4a9c-96b1-8007133ac1da",
    "category": "tech",
    "evergreen": true,
    "tweet": "#StarSchemas is a way to organize data for performant queries. In this video, we'll look at the essence of a start schema, then look at how one can be implemented using Data Factory pipelines, data flows, and a #DataLake.\n\nhttps://youtu.be/_SxpkmwXtvo"
  }
 ]

Once the application is configured, set up the automation with a GH Action. The Action uses a cron to schedule the jobs. You can configure the cron using this site. Replace the cron parameter when you want to run your posts.

You'll also need to get application credentials for the Twitter API. These credentials are needed to make the tweets work. Store these in a project's secret for each of the variables TW_CONSUMER_KEY, TW_CONSUMER_SECRET, TW_ACCESS_TOKEN_KEY and TW_ACCESS_TOKEN_SECRET as appropriate.

Create as many actions as you would like for each category you want to post. Change the line npm install && node twitter.js YOURCATEGORY with your category name from your app.

name: Lazy Tweeter Tech

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  schedule:
    - cron:  '0 11,14 * * *'
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  job1:
    name: Post something to Twitter
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/[email protected]

      - name: Post something to Twitter
        env:
          TW_CONSUMER_KEY: ${{ secrets.TW_CONSUMER_KEY}}
          TW_CONSUMER_SECRET: ${{ secrets.TW_CONSUMER_SECRET }}
          TW_ACCESS_TOKEN_KEY: ${{ secrets.TW_ACCESS_TOKEN_KEY }}
          TW_ACCESS_TOKEN_SECRET: ${{ secrets.TW_ACCESS_TOKEN_SECRET }}
        run: |          
          npm install && node twitter.js tech
      - name: Commit and push changes
        run: |
          git config --global user.name "theonemule"
          git config --global user.email "[email protected]"
          git add -A
          git commit -m "New Tweet"
          git push          

autotweet's People

Contributors

blaizestewart avatar theonemule avatar

Stargazers

Hadj H. 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.