Skip to content

Twitter-trends

Twitter-trends #15726

Workflow file for this run

name: Twitter-trends
# Controls when the action will run.
on:
schedule:
- cron: "43 * * * *" # At minute 40 past every hour.
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "twitter"
twitter:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Update & install curl, iconv & jq
run: sudo apt update && sudo apt-get install libxml2-utils curl libc-bin jq -y
- name: Run a one-line script FR
run: |
curl -s --url 'https://api.twitter.com/1.1/trends/place.json?id=23424819' \
--header 'Authorization: Bearer ${{ secrets.BEARER_TOKEN }}' | jq '.[0].trends[].name' | sed 's/#//g' | tr -d '"' > twitter_FR
- name: Run a one-line script BE
run: |
curl -s --url 'https://api.twitter.com/1.1/trends/place.json?id=23424757' \
--header 'Authorization: Bearer ${{ secrets.BEARER_TOKEN }}' | jq '.[0].trends[].name' | sed 's/#//g' | tr -d '"' > twitter_BE
- name: Run a one-line script CH
run: |
curl -s --url 'https://api.twitter.com/1.1/trends/place.json?id=23424957' \
--header 'Authorization: Bearer ${{ secrets.BEARER_TOKEN }}' | jq '.[0].trends[].name' | sed 's/#//g' | tr -d '"' > twitter_CH
- name: Permutations options
run: |
cat twitter_FR twitter_BE twitter_CH | awk '{print tolower($0)}' > twitter_lower;
cat twitter_FR twitter_BE twitter_CH | awk '{print toupper($0)}' > twitter_upper;
sed "s/ //g" twitter_FR twitter_BE twitter_CH > twitter_nospaces;
sed "s/-//g" twitter_FR twitter_BE twitter_CH > twitter_nodash;
sed "s/'//g" twitter_FR twitter_BE twitter_CH > twitter_quote;
sed 'y/ÖöËÇÀāáǎëēěèīíǐìōóǒòūúǔǖǘǚǜĀÁǍÀÉĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛÏÜ/OoECAaaaeeeeiiiioooouuuuuuuAAAAEEEEEIIIIOOOOUUUUUUUUIU/' twitter_quote twitter_upper twitter_lower twitter_nodash twitter_FR twitter_BE twitter_CH > twitter_noaccent;
- name: Run sort and uniq
run: cat twitter twitter_nospaces twitter_nodash twitter_lower twitter_upper twitter_quote twitter_noaccent >> pourquoit;LC_ALL=C sort -u pourquoit > twitter; ls -la; wc -l twitter*;
# Runs a set of commands using the runners shell
- name: Git commit and push
run: |
git config user.name "Twitter-bot"
git config user.email ""
git add twitter
git commit -m "[Bot] Twitter trends from $(date +'%Y_%m_%d %R')"
git push origin master