CKAN Sites metadata via action api #11
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: CKAN Sites metadata via action api | |
| on: | |
| workflow_dispatch: | |
| # Allows manual triggering from GitHub UI | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_METADATA_TOKEN }} | |
| CKAN_API_KEY: ${{ secrets.CKAN_API_KEY }} | |
| jobs: | |
| update-sites-metadata: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r sites-workflow/requirements.txt | |
| - name: Run CKAN Action API Script | |
| run: | | |
| echo "=== Running 2CKANActionAPI.py ===" | |
| cd sites-workflow | |
| python 2CKANActionAPI.py | |
| echo "✓ Script execution completed" | |
| - name: Run CKAN Action API Script | |
| run: | | |
| echo "=== Running 2-CKANActionAPI.py ===" | |
| cd sites-data-fetch | |
| python 2-CKANActionAPI.py | |
| echo "✓ Script execution completed" | |
| - name: Upload artifacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ckan-api-debug-files | |
| path: | | |
| sites-workflow/*.csv | |
| sites-data-fetch/*.csv | |
| sites-workflow/*.log | |
| retention-days: 7 | |
| - name: Upload generated CSV as artifact | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ckan-stats-csv | |
| path: | | |
| sites-workflow/site_urls.csv | |
| sites-workflow/ckan_stats.csv | |
| sites-data-fetch/1.csv | |
| sites-data-fetch/2.csv | |
| retention-days: 30 | |
| - name: Workflow Summary | |
| if: always() | |
| run: | | |
| echo "=== WORKFLOW SUMMARY ===" | |
| echo "Status: ${{ job.status }}" | |
| echo "Timestamp: $(date -u)" | |
| # Show file info if it exists | |
| cd sites-workflow | |
| if [ -f "1.csv" ]; then | |
| echo "Input (1.csv): $(wc -l < 1.csv) lines, $(du -h 1.csv | cut -f1)" | |
| fi | |
| if [ -f "2.csv" ]; then | |
| echo "Output (2.csv): $(wc -l < 2.csv) lines, $(du -h 2.csv | cut -f1)" | |
| fi | |
| # Show any log files | |
| if ls *.log >/dev/null 2>&1; then | |
| echo "Log files created:" | |
| ls -la *.log | |
| fi |