Skip to content

lazy-actions/tweet-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

Tweet Action

GitHub Workflow Status GitHub Workflow Status GitHub release (latest by date) GitHub

Feature

  • Tweet message to Twitter
  • User defined custom message
    • Render using EJS

Inputs

Key Required Type Description
message false string Plain message to tweet
⚠️Cannot be used with data, data_filename, template and template_filename
data false string (JSON) Parameters to render in template
Be sure to specify either data or data_filename
⚠️Cannot be used with data_filename
data_filename false string Filename where data is saved
template false string Template string based on EJS
Please refer to EJS Homepage for how to write
Be sure to specify either template or template_filename
⚠️Cannot be used with template_filename
template_filename false string Filename where template is written
oauth_consumer_key true string API key for OAuth 1.0a
See Twitter Docs for details
oauth_consumer_secret true string API secret for OAuth 1.0a
See Twitter Docs for details
oauth_token true string Access token for OAuth 1.0a
See Twitter Docs for details
oauth_token_secret true string Access token secret for OAuth 1.0a
See Twitter Docs for details

Example

Basic usage

steps:
  - uses: lazy-actions/tweet-action@main
    with:
      message: Hello World
      oauth_consumer_key: ${{ secrets.OAUTH_CONSUMER_KEY }}
      oauth_consumer_secret: ${{ secrets.OAUTH_CONSUMER_SECRET }}
      oauth_token: ${{ secrets.OAUTH_TOKEN }}
      oauth_token_secret: ${{ secrets.OAUTH_TOKEN_SECRET }}

Use template

steps:
  - uses: lazy-actions/tweet-action@main
    with:
      data: |
        {
          "name": "lazy-actions"
        }
      template: 'Hello <%- name %>'
      oauth_consumer_key: ${{ secrets.OAUTH_CONSUMER_KEY }}
      oauth_consumer_secret: ${{ secrets.OAUTH_CONSUMER_SECRET }}
      oauth_token: ${{ secrets.OAUTH_TOKEN }}
      oauth_token_secret: ${{ secrets.OAUTH_TOKEN_SECRET }}

Load template and data from file

steps:
  - uses: lazy-actions/tweet-action@main
    with:
      data_filename: tests/fixtures/data.json
      template_filename: tests/fixtures/template.ejs
      oauth_consumer_key: ${{ secrets.OAUTH_CONSUMER_KEY }}
      oauth_consumer_secret: ${{ secrets.OAUTH_CONSUMER_SECRET }}
      oauth_token: ${{ secrets.OAUTH_TOKEN }}
      oauth_token_secret: ${{ secrets.OAUTH_TOKEN_SECRET }}

Actual Example

GitHub Actions Workflow file is .github/workflows/tweet.yaml. And template file is assets/template.ejs

Tweet Result ⬇️