[go: up one dir, main page]

Skip to content

noweh/post-tweet-v2-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Send a tweet from a GitHub Actions workflow

Badge Twitter Run Tests MIT Licensed twitter

Post a Tweet from a GitHub Action workflow, with Twitter REST API for Version 2 endpoint.

Active your developer account

Before anything else, you must follow this tutorial.

  • Request approval for a developer account;
  • Once your developer account is approved, you will need to create a Project;
  • Enable read/write access for your Twitter app;
  • Generate Consumer Keys and Authentication Tokens;
  • Retrieve your Keys and Tokens from the Twitter Developer portal.

Secret Configuration

Configure the authentication keys and tokens for your Twitter app as secrets in your repository. I recommend using the TWITTER_CONSUMER_API_KEY, TWITTER_CONSUMER_API_SECRET, TWITTER_ACCESS_TOKEN, and TWITTER_ACCESS_TOKEN_SECRET secrets.

Workflow Usage

Configure your workflow to use noweh/post-tweet-v2-action@v1, and provide the tweet you want to send as the status input.

Provide the authentication keys and tokens for your Twitter app as the account-id and bearer-token inputs.

For example:

name: Send a Tweet
on: [push]
jobs:
  tweet:
    runs-on: ubuntu-latest
    steps:
      - uses: noweh/post-tweet-v2-action@v1.0
        with:
          message: "Hi, this is a test!"
          consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }}
          consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }}
          access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
          access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

Now whenever you push something to your repository, GitHub Actions will tweet on your behalf.

About

Post a Tweet with API V2 from a GitHub Action

Resources

License

Stars

Watchers

Forks

Packages

No packages published