Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snow-actions/tweet
Tweet to Twitter via GitHub Actions.
https://github.com/snow-actions/tweet
actions github-actions twitter
Last synced: 3 months ago
JSON representation
Tweet to Twitter via GitHub Actions.
- Host: GitHub
- URL: https://github.com/snow-actions/tweet
- Owner: snow-actions
- License: mit
- Created: 2020-08-08T08:26:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T08:20:03.000Z (almost 2 years ago)
- Last Synced: 2024-11-14T14:12:16.835Z (3 months ago)
- Topics: actions, github-actions, twitter
- Language: TypeScript
- Homepage:
- Size: 3.44 MB
- Stars: 57
- Watchers: 3
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Tweet action
[![CI](https://github.com/snow-actions/tweet/actions/workflows/ci.yml/badge.svg)](https://github.com/snow-actions/tweet/actions/workflows/ci.yml)
Tweet via GitHub Actions.
## Usage
1. Create your Twitter App in [developer.twitter.com](https://developer.twitter.com/en/apps).
1. Generate Twitter API v1.1 tokens. ([Not Twitter API v2](#why-not-twitter-api-v2))
1. Set secrets `TWITTER_CONSUMER_API_KEY`, `TWITTER_CONSUMER_API_SECRET_KEY`, `TWITTER_ACCESS_TOKEN`, `TWITTER_ACCESS_TOKEN_SECRET` in settings.
1. Create workflow YAML.### Basic
```yml
steps:
- name: Tweet
uses: snow-actions/[email protected]
with:
status: |
Released ${{ github.event.release.name }}
${{ github.event.release.html_url }}
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 }}
```### Optional
```yml
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 }}
steps:
- uses: actions/checkout@v3
- name: Tweet summary
id: summary
uses: snow-actions/[email protected]
with:
status: |
Released ${{ github.event.release.name }}
${{ github.event.release.html_url }}
media_paths: |
1st.png
2nd.png
- name: Tweet details
uses: snow-actions/[email protected]
with:
status: |
Additional information
in_reply_to_status_id: ${{ fromJSON(steps.summary.outputs.response).id_str }}
```## Environments
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|## Inputs & Outputs
See [action.yml](action.yml) and [Twitter API reference](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update).
### Inputs
Request parameters.
|name|required|description|
|---|---|---|
|status|required|The text of the status update. URL encode as necessary. [t.co link wrapping](https://developer.twitter.com/en/docs/basics/tco) will affect character counts.|
|media_paths|optional|[Upload media](https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview) path(s). You may attach up to 4 photos, 1 animated GIF or 1 video in a Tweet.|#### Media types & size restrictions
Size restrictions for uploading via API
- Image 5MB
- GIF 15MB
- Video 15MB (when using media_category=amplify)### Outputs
Response.
|name|description|
|---|---|
|response|Response JSON|## Supported
### Runners
See [ci.yml](.github/workflows/ci.yml)
- `ubuntu-*`
- `windows-*`
- `macos-*`
- `self-hosted`### Events
- Any
## Why not Twitter API v2?
The access token of Twitter API v2 has a time limit.
If the scope `offline.access` is applied an OAuth 2.0 refresh token will be issued. With this refresh token, we obtain an access token. Secure storage is required to keep these tokens.