GitHub Action to post on twitter when any event triggers on repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Go to file
Lukasz Gornicki d1e508b6c2
node12 to node16 (#28)
12 months ago
.github/workflows update README 4 years ago
dist update index file 4 years ago
docs update contributing 4 years ago
img update logo 4 years ago
src add JS Doc to functions 4 years ago
test update tests 4 years ago
.eslintignore add eslint and format code 4 years ago
.eslintrc add eslint and format code 4 years ago
.gitignore add gitignore 4 years ago
LICENSE Create LICENSE (#4) 4 years ago
README.md update README 4 years ago
action.yml node12 to node16 (#28) 12 months ago
index.js update index file 4 years ago
package-lock.json Bump minimist from 1.2.5 to 1.2.6 (#20) 2 years ago
package.json Bump @actions/core from 1.2.3 to 1.2.6 (#8) 3 years ago

README.md

Github Twittction logo

Github Twittction

Overview

This action supports every github event. Currently the app publish default messages to twitter when one of these GitHub events will trigger:

  • push
  • pull_request
  • release

Here you can see default messages: Default messages

Motivation

I am using this project to hone my coding skills. I have some but they are not the greatest. I believe that with help of my brother/mentor 😍, this project could be a stepping stone towards my new career.

What do you need?

For this paragraph I would like to thank https://github.com/gr2m/twitter-together. Amazing job I learned a lot 📈

Create a twitter app with your shared twitter account and store the credentials as TWITTER_API_KEY, TWITTER_API_SECRET_KEY, TWITTER_ACCESS_TOKEN and TWITTER_ACCESS_TOKEN_SECRET in your repositorys secrets settings.

💥 Hopefully in the future people will be copying my code 🙏

Example usage

Make sure to replace {VERSION} with the version of the action that you wish to use.

push event

name: 'testing workflow'
# Trigger on push
  push:
    branches:
      - master
jobs:
  test:
    name: posting_on_twitter
    runs-on: ubuntu-latest
    steps:
      - name: tweety
        uses: m1ner79/Github-Twittction@{VERSION}
        with:
            twitter_status: "𝕖𝕪 𝕪𝕠𝕦! 👋 𝕎𝕖 ${{ github.event.repository.owner.name}} 𝕙𝕒𝕧𝕖 𝕒 𝕟𝕖𝕨 𝕔𝕠𝕞𝕞𝕚𝕥 𝕚𝕟 𝕥𝕙𝕖 𝕞𝕒𝕤𝕥𝕖𝕣 𝕓𝕣𝕒𝕟𝕔𝕙 🥳 \n 𝕀𝕥𝕤 𝕟𝕒𝕞𝕖 𝕚𝕤 ${{ github.event.commits[0].message }} 😱 \n 𝕙𝕖𝕔𝕜 𝕚𝕥 𝕠𝕦𝕥 𝕙𝕖𝕣𝕖 👇 \n ${{ github.event.commits[0].url }}"
            twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} 
            twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} 
            twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} 
            twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} 

pull_request event

name: 'testing workflow'
# Trigger on pull_request
on: 
  pull_request:
    types:
      - opened
jobs:
  test:
    name: posting_on_twitter
    runs-on: ubuntu-latest
    steps:
      - name: tweety
        uses: m1ner79/Github-Twittction@{VERSION}
        with:
            twitter_status: "🅆🄴 🄲🄰🄽 🅂🄴🄴 🄰 🄿🅄🄻🄻_🅁🄴🅀🅄🄴🅂🅃 ${{github.event.pull_request.title}} 🄲🅁🄴🄰🅃🄴🄳 🄱🅈 ${{github.event.pull_request.head.repo.full_name}} 🄲🄻🄸🄲🄺 🄷🄴🅁🄴 ${{github.event.pull_request.html_url}} 🄰🄽🄳 🅂🄴🄴 🄸🅃 🅈🄾🅄🅁🅂🄴🄻🄵"
            twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} 
            twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} 
            twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} 
            twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} 

release event

name: 'testing workflow'
# Trigger on release
on: 
  release:
    types: 
      - published
jobs:
  test:
    name: posting_on_twitter
    runs-on: ubuntu-latest
    steps:
      - name: tweety
        uses: m1ner79/Github-Twittction@{VERSION}
        with:
            twitter_status: "Ⓛⓞⓞⓚⓢ ⓛⓘⓚⓔ ⓐ ⓝⓔⓦ ⓡⓔⓛⓔⓐⓢⓔ ${{github.event.release.tag_name}} ⓘⓢ ⓘⓝ ${{github.event.repository.full_name}}.Ⓜⓞⓡⓔ ⓓⓔⓣⓐⓘⓛⓢ ⓐⓡⓔ ⓐⓥⓐⓘⓛⓐⓑⓛⓔ ⓗⓔⓡⓔ ${{github.event.release.html_url}}"
            twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} 
            twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} 
            twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} 
            twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} 

Without custom message

name: 'testing workflow'
# Trigger on push
on: 
  push:
    branches:
      - master
jobs:
  test:
    name: posting_on_twitter
    runs-on: ubuntu-latest
    steps:
      - name: tweety
        uses: m1ner79/Github-Twittction@{VERSION}
        with:
            # twitter_status: is deactivated so you will see one of our default messages
            # twitter_status: "𝕖𝕪 𝕪𝕠𝕦! 👋 𝕎𝕖 ${{ github.event.repository.owner.name}} 𝕙𝕒𝕧𝕖 𝕒 𝕟𝕖𝕨 𝕔𝕠𝕞𝕞𝕚𝕥 𝕚𝕟 𝕥𝕙𝕖 𝕞𝕒𝕤𝕥𝕖𝕣 𝕓𝕣𝕒𝕟𝕔𝕙 🥳 \n 𝕀𝕥𝕤 𝕟𝕒𝕞𝕖 𝕚𝕤 ${{ github.event.commits[0].message }} 😱 \n 𝕙𝕖𝕔𝕜 𝕚𝕥 𝕠𝕦𝕥 𝕙𝕖𝕣𝕖 👇 \n ${{ github.event.commits[0].url }}"
            twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} 
            twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} 
            twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} 
            twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} 

Default messages

push default message:
`${payload.pusher.name} just created a commit to ${payload.repository.full_name}. More details are available here: ${payload.commits[0].url}`

pull_request default message:
`${payload.pull_request.head.repo.full_name} just created a pull request: ${payload.pull_request.title}. More info is available here: ${payload.pull_request.html_url}`;

release default message:
`A new release ${payload.release.tag_name} is in ${payload.repository.full_name}. More details are available here ${payload.release.html_url}`;

Custom message

To create a custom twitter post I used these two websites:

Go nuts and make it as sparkly as you like (just remember about twitter character limitations https://developer.twitter.com/en/docs/basics/counting-characters).

Contributing

Contributions are more than welcome 🤝.

License

MIT