Run Daily Report Hotosm Hashtag #469
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: Run Daily Report Hotosm Hashtag | |
on: | |
schedule: | |
- cron: "0 5 * * *" # Run every day at 4 UTC | |
# push: | |
# branches: | |
# - master | |
jobs: | |
issue: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.11 | |
- name: Install Osmium | |
run: sudo apt-get install -y osmium-tool | |
- name: Install necessary dependecies | |
run: | | |
pip install flare-floss | |
pip install osmsg | |
pip install -r requirements.txt | |
pip install tweepy | |
- name: Generate Daily Hashtag Stats | |
run: | | |
osmsg --url "https://planet.openstreetmap.org/replication/day" --format csv image --last_day --tags 'building' 'highway' 'waterway' 'amenity' --name stats/hotosm/Daily/stats --all_tags --read_from_metadata stats/hotosm/Daily/stats_metadata.json --hashtags hotosm --summary --charts --meta --force --temp | |
- name: add stats to git | |
continue-on-error: true | |
run: | | |
git pull | |
git config --global user.email ${{ secrets.GIT_EMAIL }} | |
git config --global user.name ${{ secrets.GIT_USERNAME }} | |
base_dir=stats/hotosm/Daily | |
mkdir -p $base_dir | |
mv $base_dir/stats_summary.md $base_dir/Readme.md | |
git add -f $base_dir/* | |
git commit -m "Updated Daily hotosm stats" | |
git push | |
- name: Tweet Stats | |
continue-on-error: true | |
env: #assign variables | |
API_KEY: ${{ secrets.API_KEY }} | |
API_KEY_SECRET: ${{ secrets.API_KEY_SECRET }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} | |
BEARER_TOKEN: ${{ secrets.BEARER_TOKEN }} | |
run: | | |
commit_id=$(git rev-parse --short HEAD) | |
python tweet.py --git $commit_id --name stats/hotosm/Daily/stats --tweet 'Tasking Manager Last Day' --mention '@hotosm' |