Use this action to send a tweet from a GitHub actions workflow.
This action is implemented in the Dart language and uses twitter_api_v2 for tweeting.
Note:
This project is inspired by send-tweet-action created by @ethomson.
First, you'll need to create a Twitter application if you haven't already. This will allow you to programmatically authenticate to the Twitter API and send a tweet.
If you haven't already, visit developer.twitter.com/apps and create a Twitter application. Then create keys and tokens to use for authentication.
Configure the authentication keys and tokens for your Twitter
app as secrets in your repository. I recommend using the TWITTER_BEARER_TOKEN
,
TWITTER_CONSUMER_KEY
, TWITTER_CONSUMER_SECRET
,
TWITTER_ACCESS_TOKEN
, and TWITTER_ACCESS_TOKEN_SECRET
secrets.
Configure your workflow to use dart-actions/tweet@v1.0.0
,
and provide the tweet you want to send as the text
input.
Provide the authentication keys and tokens for your Twitter app
as the consumer-key
, consumer-secret
, access-token
, and
access-token-secret
inputs.
For example:
name: Send a Tweet
on:
[push]
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- uses: dart-actions/tweet@v1.0.0
with:
text: "Hello, World!"
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 }}
Or, you can use access token issued by OAuth 2.0 PKCE as bearer-token
.
name: Send a Tweet
on:
[push]
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- uses: dart-actions/tweet@v1.0.0
with:
text: "Hello, World!"
bearer-token: ${{ secrets.TWITTER_BEARER_TOKEN }}
Now whenever you push something to your repository, GitHub Actions will tweet on your behalf.