like-banner #1853
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: like-banner | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
jobs: | |
get-likes: | |
runs-on: ubuntu-latest | |
env: | |
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: twitter-like-badge | |
- name: git config | |
run: | | |
git config user.email [email protected] | |
git config user.name github-actions | |
- name: TWITTER API with curl | |
run: | | |
curl 'https://api.twitter.com/2/tweets?ids=1511034067344572422&tweet.fields=public_metrics&expansions=attachments.media_keys&media.fields=public_metrics' --header 'Authorization: Bearer ${{ secrets.TWITTER_BEARER_TOKEN }}' -o likes | |
shell: bash | |
- name: Commit and Push changes | |
run: | | |
git diff-index --quiet HEAD || (git commit -a -m'[bot]: update latest twitter likes data' --allow-empty && git push -f) | |