Check for New OSI Time Standards PDF #21
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: Check for New OSI Time Standards PDF | |
| on: | |
| # Run daily at 9 AM Pacific Time (5 PM UTC) | |
| schedule: | |
| - cron: '0 17 * * *' | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| check-and-process: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check for new PDF | |
| id: check_pdf | |
| run: | | |
| echo "Checking for changes to OSI Time Standards..." | |
| echo "This will detect:" | |
| echo " - Newer year ranges (e.g., 2025-2026, 2026-2027, etc.)" | |
| echo " - URL changes for the same year (data corrections)" | |
| OUTPUT=$(node .github/scripts/check-for-new-pdf.js) | |
| echo "$OUTPUT" | |
| # Extract outputs for next steps | |
| if echo "$OUTPUT" | grep -q "GITHUB_OUTPUT:"; then | |
| PDF_URL=$(echo "$OUTPUT" | grep "PDF_URL=" | cut -d'=' -f2-) | |
| LINK_TEXT=$(echo "$OUTPUT" | grep "LINK_TEXT=" | cut -d'=' -f2-) | |
| echo "pdf_url=$PDF_URL" >> $GITHUB_OUTPUT | |
| echo "link_text=$LINK_TEXT" >> $GITHUB_OUTPUT | |
| fi | |
| continue-on-error: true | |
| - name: Evaluate check result | |
| id: evaluate | |
| run: | | |
| if [ ${{ steps.check_pdf.outcome }} == 'success' ]; then | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| echo "Check succeeded - changes detected (newer year or updated URL)" | |
| else | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| echo "Check completed - no changes detected" | |
| fi | |
| - name: Log final status | |
| run: | | |
| echo "==========================================" | |
| echo "Final Workflow Status" | |
| echo "==========================================" | |
| echo "Check outcome: ${{ steps.check_pdf.outcome }}" | |
| echo "Changes detected: ${{ steps.evaluate.outputs.changes_detected }}" | |
| if [ "${{ steps.evaluate.outputs.changes_detected }}" == "true" ]; then | |
| echo "Next: Workflow will continue to subsequent steps" | |
| else | |
| echo "Next: Workflow will end (no further action needed)" | |
| fi | |
| echo "==========================================" | |
| # This step only runs if changes were detected | |
| - name: Process new PDF with pdfplumber | |
| if: steps.evaluate.outputs.changes_detected == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| pip install pdfplumber | |
| echo "==========================================" | |
| echo "CHANGES DETECTED - Processing PDF" | |
| echo "==========================================" | |
| bash .github/scripts/process-new-pdf.sh \ | |
| "${{ steps.check_pdf.outputs.pdf_url }}" \ | |
| "${{ steps.check_pdf.outputs.link_text }}" | |
| - name: Workflow complete | |
| run: | | |
| echo "Workflow execution complete" | |
| if [ "${{ steps.evaluate.outputs.changes_detected }}" == "false" ]; then | |
| echo "Ending workflow - will check again on next scheduled run" | |
| fi |