Check DigitalOcean Bill #97
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: Check DigitalOcean Bill | |
on: | |
schedule: | |
- cron: "0 16 * * *" # run once a day at 12 AM (philippine standard time) | |
workflow_dispatch: | |
jobs: | |
curl: | |
runs-on: ubuntu-latest | |
env: | |
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
steps: | |
- name: GET /v2/customers/my/balance | |
run: | | |
MONTH_TO_DATE_USAGE=$(curl -X GET \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | |
"https://api.digitalocean.com/v2/customers/my/balance" | jq '.month_to_date_usage') | |
echo "MONTH_TO_DATE_USAGE=$MONTH_TO_DATE_USAGE" >> $GITHUB_ENV | |
- name: "this month bill: ${{ env.MONTH_TO_DATE_USAGE }}" | |
run: echo $MONTH_TO_DATE_USAGE |