Skip to content

Keep readers up to date on new entries to your awesome list.

License

Notifications You must be signed in to change notification settings

protontypes/awesome-twitter-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 

Repository files navigation

Awesome Twitter Action

An GitHub Action that tweets new entries on awesome lists. The goal of this project is to inform readers about new projects on an awesome list in an easy way. Contributors also have a better way to advertise new projects via the awesome list and can create custom tweet messages.

Implementation

Check if the last commit message on the main branch contains https and creates a tweet based on the corresponding line.

Usage

  1. Add the Github Action Script to .github/workflows/tweet.yml
  2. Create a Twitter Developer Account.
  3. Add the Login data to your project secrets.
  4. Activate your Github Actions by pressing the Activate GitHub Action for this Projects button on the Action Tab of your project.
  5. Create a Commit message with an URL. Since the title of a pull request is included in the commit message, contributors can create user-specific Twitter messages.

Github Action

name: Send URLs from Commit Message as Tweets
on: 
  push:
   branches:
      - main
jobs:
  tweet:
    runs-on: ubuntu-latest
    if: "contains(github.event.head_commit.message, 'https')"     
    steps:
      - name: Extract Line with URL as Tweet Message  
        env: 
          default_hashtags: " #opensource #protontypes"
        run: |
              echo -e "${{ github.event.head_commit.message }}" >> tweet
              tweet_message="$(cat tweet | grep -m 1 https*)"$default_hashtags
              echo "tweet_message=$tweet_message" >> $GITHUB_ENV
      
      - name: Send Tweet       
        uses: ethomson/send-tweet-action@v1
        with:
          status: ${{ env.tweet_message }}
          consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
          consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
          access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
          access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

About

Keep readers up to date on new entries to your awesome list.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks