Run Monthly Report Nepal #10
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 Monthly Report Nepal | |
on: | |
schedule: | |
- cron: "0 5 1 * *" # every month at day 1 05 | |
# push: | |
# branches: | |
# - master | |
jobs: | |
issue: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install Osmium | |
run: sudo apt-get install -y osmium-tool | |
- name: Install necessary dependecies | |
run: | | |
pip install flare-floss | |
pip install -e . | |
pip install tweepy | |
pip install -r requirements.txt | |
- name: Generate Monthly Stats | |
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 }} | |
OSM_USERNAME: ${{ secrets.OSM_USERNAME }} | |
OSM_PASSWORD: ${{ secrets.OSM_PASSWORD }} | |
run: | | |
osmsg --url "http://download.geofabrik.de/asia/nepal-updates" --username '${{ secrets.OSM_USERNAME }}' --password '${{ secrets.OSM_PASSWORD }}' --format image csv --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/Nepal/Monthly/stats --read_from_metadata stats/Nepal/Monthly/stats_metadata.json --all_tags --summary --charts --meta --temp | |
- name: add stats to git | |
run: | | |
git pull | |
git config --global user.email "[email protected]" | |
git config --global user.name "kshitijrajsharma" | |
base_dir=stats/Nepal/Monthly | |
mkdir -p $base_dir | |
mv $base_dir/stats_summary.md $base_dir/Readme.md | |
git add -f $base_dir/* | |
git commit -m "Updated Monthly Nepal 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/Nepal/Monthly/stats --tweet 'Nepal Last Month' |