Update papers #13
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 papers | |
| on: | |
| schedule: | |
| - cron: "17 6 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| max_results: | |
| description: Number of recent arXiv matches to inspect | |
| required: false | |
| default: "500" | |
| permissions: {} | |
| concurrency: | |
| group: update-papers | |
| cancel-in-progress: false | |
| jobs: | |
| collect: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| contents: write | |
| pages: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.13" | |
| - name: Test collector | |
| run: python3 -m unittest discover -s tests -v | |
| - name: Collect and render papers | |
| env: | |
| MAX_RESULTS: ${{ inputs.max_results || '500' }} | |
| run: python3 scripts/collect.py --max-results "$MAX_RESULTS" | |
| - name: Validate generated data | |
| run: | | |
| python3 -m unittest discover -s tests -v | |
| node --check docs/app.mjs | |
| node --test tests/site.test.mjs | |
| python3 scripts/collect.py --render-only | |
| git diff --check | |
| - name: Commit changes | |
| id: commit | |
| run: | | |
| if git diff --quiet; then | |
| echo "No paper changes found" | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md papers.md data/papers.json data/papers.csv docs/data | |
| git commit -m "chore(data): update arXiv papers" | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| - name: Push changes | |
| id: push | |
| if: steps.commit.outputs.changed == 'true' | |
| continue-on-error: true | |
| run: git push origin HEAD:main | |
| - name: Retry after a concurrent main update | |
| if: steps.push.outcome == 'failure' | |
| env: | |
| MAX_RESULTS: ${{ inputs.max_results || '500' }} | |
| run: | | |
| git fetch origin main | |
| git switch --detach origin/main | |
| python3 -m unittest discover -s tests -v | |
| node --check docs/app.mjs | |
| node --test tests/site.test.mjs | |
| python3 scripts/collect.py --max-results "$MAX_RESULTS" | |
| python3 -m unittest discover -s tests -v | |
| python3 scripts/collect.py --render-only | |
| git diff --check | |
| if git diff --quiet; then | |
| echo "Concurrent update already contains current data" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md papers.md data/papers.json data/papers.csv docs/data | |
| git commit -m "chore(data): update arXiv papers" | |
| git push origin HEAD:main | |
| - name: Configure Pages | |
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5 | |
| with: | |
| path: docs | |
| deploy: | |
| needs: collect | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5 |