Tweet via GitHub Actions.
- Create your Twitter App in developer.twitter.com.
- Set secrets
TWITTER_CONSUMER_API_KEY
,TWITTER_CONSUMER_API_SECRET_KEY
,TWITTER_ACCESS_TOKEN
,TWITTER_ACCESS_TOKEN_SECRET
in settings. - Create workflow YAML.
.github/workflows/released.yml
name: 'Tweet when released'
on:
release:
types: [released]
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- name: Tweet
id: tweet
uses: snow-actions/tweet@v1.1.1
env:
CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
CONSUMER_API_SECRET_KEY: ${{ secrets.TWITTER_CONSUMER_API_SECRET_KEY }}
ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
with:
status: |
Released ${{ github.event.release.name }}
${{ github.event.release.html_url }}
media_paths: |
1st.png
2nd.png
- run: echo ${{ steps.tweet.outputs.response }}
Authentication parameters.
name | required | description |
---|---|---|
CONSUMER_API_KEY | required | Consumer API key |
CONSUMER_API_SECRET_KEY | required | Consumer API secret key |
ACCESS_TOKEN | required | Access token |
ACCESS_TOKEN_SECRET | required | Access token secret |
See action.yml and Twitter API reference.
Request parameters.
name | required | description |
---|---|---|
status | required | The text of the status update. URL encode as necessary. t.co link wrapping will affect character counts. |
media_paths | optional | Upload media path(s). You may include up to 4 photos in a Tweet. |
Response.
name | description |
---|---|
response | Response JSON |