Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/workflows/auto-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "dblp-publications-scraper"]
path = dblp-publications-scraper
url = https://github.com/imethanguo/dblp-publications-scraper.git

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dblp-publications-scraper
2 changes: 1 addition & 1 deletion public/bundle.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ async function main() {
return value;
}), 'validate date string'),
authors: Joi.array().min(1).items(Joi.string()).required(),
venue: Joi.string().min(1).required(),
venueShort: Joi.string().min(1).required(),
venue: Joi.string().allow('').required(),
venueShort: Joi.string().allow('').required(),
tags: Joi.array().items(Joi.string()),
awards: Joi.array().items(Joi.string()),
paperUrl: Joi.string().allow(null, ''),
Expand Down
Loading