Downloads Detailed Weather #2562
This file contains hidden or 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: "Downloads Detailed Weather" | |
| on: | |
| schedule: | |
| - cron: '25 * * * *' | |
| workflow_dispatch: | |
| inputs: | |
| logLevel: | |
| description: 'Log level' | |
| required: true | |
| default: 'warning' | |
| type: choice | |
| options: | |
| - info | |
| - warning | |
| - debug | |
| tags: | |
| description: 'Test scenario tags' | |
| required: false | |
| type: boolean | |
| environment: | |
| description: 'Environment to run tests against' | |
| type: environment | |
| required: true | |
| jobs: | |
| download-weather: | |
| permissions: write-all | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install jq | |
| run: sudo apt-get install jq | |
| - name: Get current date | |
| id: current_date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Debug WEATHER_API_KEY | |
| run: | | |
| if [ -z "${{ secrets.WEATHER_API_KEY }}" ]; then | |
| echo "❌ WEATHER_API_KEY is empty" | |
| exit 1 | |
| else | |
| echo "✅ WEATHER_API_KEY is set" | |
| echo "Length: ${#WEATHER_API_KEY}" # just check length | |
| fi | |
| shell: bash | |
| # Fetch data from your API | |
| - name: Fetch Current/Realtime API data | |
| run: | | |
| curl -X GET "http://api.weatherapi.com/v1/current.json?key=${{ secrets.WEATHER_API_KEY }}&q=22.5744,88.3629&aqi=yes" -o tmp/current_weather_response.json | |
| - name: Fetch Marine API data | |
| run: | | |
| curl -X GET "http://api.weatherapi.com/v1/marine.json?key=${{ secrets.WEATHER_API_KEY }}&q=22.5744,88.3629&days=3" -o tmp/marine_weather_response.json | |
| - name: Fetch Astronomy API data | |
| run: | | |
| curl -X GET "http://api.weatherapi.com/v1/astronomy.json?key=${{ secrets.WEATHER_API_KEY }}&q=22.5744,88.3629&dt=${{ steps.current_date.outputs.date }}" -o tmp/astronomy_response.json | |
| - name: Fetch Forecast API data | |
| run: | | |
| curl -X GET "http://api.weatherapi.com/v1/forecast.json?key=${{ secrets.WEATHER_API_KEY }}&q=22.5744,88.3629&days=2&aqi=yes&alerts=yes" -o tmp/forecast_response.json | |
| - name: Check if files changed | |
| run: | | |
| ls -lh tmp/ | |
| md5sum tmp/*.json | |
| - name: Commit all files | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Update detailed weather download on ${{ env.DATE }}" || echo "Nothing to commit" | |
| git push origin main |