-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (106 loc) · 4.25 KB
/
Copy pathweekly-x-crawl.yml
File metadata and controls
125 lines (106 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Weekly X Prompt Crawl
# Every Monday 01:00 UTC ≈ 09:00 Asia/Shanghai
on:
schedule:
- cron: '0 1 * * 1'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: write
jobs:
crawl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Run weekly crawl
env:
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }}
X_BEARER_TOKEN: ${{ secrets.X_BEARER_TOKEN }}
run: |
python scripts/weekly_x_crawl.py --max-results 25 --min-likes 0
- name: Detect changes
id: diff
run: |
if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
DATE=$(date -u +%F)
echo "date=$DATE" >> "$GITHUB_OUTPUT"
if [ -f "docs/x-crawl-candidates/${DATE}.json" ]; then
echo "summary<<EOF" >> "$GITHUB_OUTPUT"
cat "docs/x-crawl-candidates/${DATE}.json" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Create branch, commit, open PR
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE="${{ steps.diff.outputs.date }}"
BRANCH="chore/x-crawl-${DATE}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add docs/x-crawl-candidates docs/x-crawl-log.md
git commit -m "chore: weekly X crawl candidates ${DATE}
Auto-generated by weekly-x-crawl workflow.
Review and promote into prompts/* (newest first) before merge if curating."
git push -u origin "$BRANCH" --force
# Open PR if none exists for this branch
if ! gh pr list --head "$BRANCH" --json number --jq 'length' | grep -q '^[1-9]'; then
gh pr create \
--title "chore: weekly X crawl candidates (${DATE})" \
--body "$(cat <<'EOF'
## Weekly X crawl
Automated candidate dump for **Kling I2V** and **Seedance** prompts.
### Next steps (newest-first rule)
1. Open `docs/x-crawl-candidates/` for this week
2. Extract full prompts (follow threads when needed)
3. Insert at the **top** of `prompts/i2v-from-x.md` / `prompts/seedance-from-x.md`
4. Mirror highlights into `README.md` + `README-en.md` §1 / §2
5. Credit Source (`@handle` + post URL)
### Optional
Add repository secret `TWITTER_BEARER_TOKEN` (X API v2 Bearer) for live search results.
Without it, the report is checklist-only.
/cc maintainers
EOF
)"
fi
- name: Open tracking issue when no file changes
if: steps.diff.outputs.changed == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE="${{ steps.diff.outputs.date }}"
TITLE="Weekly X crawl checklist — ${DATE}"
# Avoid duplicate open issues with same title
EXISTING=$(gh issue list --state open --search "in:title ${TITLE}" --json number --jq '.[0].number // empty')
if [ -n "$EXISTING" ]; then
echo "Issue already open: #$EXISTING"
exit 0
fi
gh issue create --title "$TITLE" --body "$(cat <<EOF
## Weekly X prompt crawl
Date (UTC): **${DATE}**
Workflow finished but produced no git changes (or crawl was a no-op).
### Manual queries
\`\`\`
(Kling OR 可灵) ("image to video" OR I2V OR 图生视频) (prompt OR 提示词)
Seedance (Prompt OR 提示词 OR "Scene 1" OR "SHOT 1")
from:MayorKingAI Kling
\`\`\`
### Promote rule
New entries go **at the top** of the matching section (newest first).
See [docs/x-crawl-log.md](./docs/x-crawl-log.md).
EOF
)"