edit API script with rate limitting param #31
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: Update CKAN Metadata | |
| on: | |
| schedule: | |
| # Run every Sunday at 4 AM UTC | |
| - cron: '0 4 * * 0' | |
| workflow_dispatch: # Allow manual triggering | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'sites-workflow/**' | |
| - 'Dockerfile' | |
| - 'docker-entrypoint.sh' | |
| - 'requirements.txt' | |
| env: | |
| DOCKER_IMAGE: dathere/ckan-metadata-workflow | |
| DOCKER_TAG: latest | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image-digest: ${{ steps.build.outputs.digest }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push Docker image | |
| id: build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| run-workflow: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Run CKAN metadata workflow | |
| run: | | |
| docker run --rm \ | |
| -e CKAN_API_KEY="${{ secrets.CKAN_API_KEY }}" \ | |
| -v ${{ github.workspace }}/data:/app/data \ | |
| -v ${{ github.workspace }}/logs:/app/logs \ | |
| ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} | |
| - name: Upload workflow logs | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: workflow-logs-${{ github.run_number }} | |
| path: logs/ | |
| retention-days: 30 | |
| - name: Upload generated data | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: generated-data-${{ github.run_number }} | |
| path: data/ | |
| retention-days: 7 |