use jq to select the fields that need to be preserved

This commit is contained in:
John Bowdre 2024-02-09 17:00:21 -06:00
parent 6620638893
commit 3e596863aa

View file

@ -13,7 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch Tempest API data
run: curl --location "https://swd.weatherflow.com/swd/rest/better_forecast?station_id=${{ secrets.TEMPEST_STATION }}&token=${{ secrets.TEMPEST_TOKEN }}&units_temp=f&units_wind=mph&units_pressure=inhg&units_precip=in&units_distance=mi" | jq '.current_conditions' > tempest.json
run: |
curl --location "https://swd.weatherflow.com/swd/rest/better_forecast?station_id=${{ secrets.TEMPEST_STATION }}&token=${{ secrets.TEMPEST_TOKEN }}&units_temp=f&units_wind=mph&units_pressure=inhg&units_precip=in&units_distance=mi" \
| jq '.current_conditions | {air_temperature: (.air_temperature | round), conditions, feels_like: (.feels_like | round), icon, precip_accum_local_day, pressure_trend, relative_humidity, station_pressure: ((.station_pressure * 100) | round | . / 100), time, wind_direction_cardinal, wind_gust}'' \
> tempest.json
- name: POST to paste.lol
run: |
request_body='{"title": "tempest.json", "content": '"$(jq -Rsa . tempest.json)"'}'