GitHub Action
GitHub Twittction
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
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.
β 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 repositoryβs secrets settings.
π₯ Hopefully in the future people will be copying my code π
β Make sure to replace {VERSION} with the version of the action that you wish to use.
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 }}
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 }}
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 }}
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 }}
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}`;
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).
Contributions are more than welcome π€.