Regular Auto Update #4
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: Regular Auto Update | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| on: | |
| schedule: | |
| # 每两周的周一凌晨2点运行 | |
| - cron: '0 2 * * 1/2' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: auto-scrape | |
| cancel-in-progress: false | |
| jobs: | |
| scrape-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Detect scraper directory | |
| run: | | |
| if [ -x "./sp" ]; then | |
| echo "SCRAPER_DIR=." >> "$GITHUB_ENV" | |
| elif [ -x "./dblp-publications-scraper/sp" ]; then | |
| echo "SCRAPER_DIR=./dblp-publications-scraper" >> "$GITHUB_ENV" | |
| else | |
| echo "Cannot find sp launcher. Checked ./sp and ./dblp-publications-scraper/sp" | |
| ls -la | |
| exit 1 | |
| fi | |
| - name: Install scraper dependencies | |
| working-directory: ${{ env.SCRAPER_DIR }} | |
| run: | | |
| chmod +x ./sp | |
| ./sp i | |
| - name: Run scraper | |
| working-directory: ${{ env.SCRAPER_DIR }} | |
| env: | |
| VENUE_SHORT_LLM_API_KEY: ${{ secrets.VENUE_SHORT_LLM_API_KEY }} | |
| run: | | |
| CONFIG_FILE="config.github.json" | |
| if [ ! -f "$CONFIG_FILE" ]; then | |
| CONFIG_FILE="config.json" | |
| fi | |
| if [ ! -f "$CONFIG_FILE" ]; then | |
| echo "No config file found in $PWD" | |
| ls -la | |
| exit 1 | |
| fi | |
| CI_CONFIG_FILE="config.ci.json" | |
| python - <<'PY' | |
| import json | |
| source_file = "config.github.json" | |
| try: | |
| with open(source_file, "r", encoding="utf-8") as f: | |
| cfg = json.load(f) | |
| except FileNotFoundError: | |
| source_file = "config.json" | |
| with open(source_file, "r", encoding="utf-8") as f: | |
| cfg = json.load(f) | |
| cfg["existing_js_path"] = "../collection/auto-collected/auto_collected.js" | |
| with open("config.ci.json", "w", encoding="utf-8") as f: | |
| json.dump(cfg, f, ensure_ascii=False, indent=2) | |
| print(f"Prepared CI config from: {source_file}") | |
| PY | |
| echo "Using config: $CI_CONFIG_FILE" | |
| ./sp --config "$CI_CONFIG_FILE" | |
| - name: Check for changes to commit | |
| id: check_changes | |
| run: | | |
| git add -A | |
| if git diff --cached --quiet; then | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| echo "No changes to commit, skipping PR." | |
| exit 0 | |
| else | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create pull request for updates | |
| if: steps.check_changes.outputs.changes_detected == 'true' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| commit-message: "chore: auto update publications" | |
| branch: "chore/auto-scrape-updates" | |
| delete-branch: true | |
| title: "chore: auto update publications" | |
| body: | | |
| This PR is automatically generated by the Auto Scrape workflow. | |
| Changes include: | |
| - refreshed auto-collected publications | |
| - updated bundled JSON assets | |
| labels: | | |
| automation | |
| publications |