Skip to content

Add codex-test.md with a URL #3

Add codex-test.md with a URL

Add codex-test.md with a URL #3

Workflow file for this run

name: Scrape Codex Links
on:
push:
branches:
- main
paths:
- "prompts/**/*.md"
workflow_dispatch:
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install jq
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Find Codex links
id: find
run: |
links=$(grep -Eroh 'https://chatgpt.com/s/[A-Za-z0-9_]+' prompts || true)
if [ -z "$links" ]; then
echo "No Codex links found."
exit 0
fi
echo "links<<EOF" >> $GITHUB_OUTPUT
echo "$links" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Scrape and append extracted prompts
if: steps.find.outputs.links != ''
run: |
echo "${{ steps.find.outputs.links }}" | sort -u | while read -r link; do
[ -z "$link" ] && continue
echo "Processing $link..."
grep -rl "$link" prompts | while read -r file; do
echo " Checking $file..."
if grep -q "### Extracted Prompt" "$file"; then
echo " (Already scraped — skipping $file)"
continue
fi
echo " Fetching from scraper..."
json=$(curl -s "http://35.222.246.223:8080/scrape?url=$link")
content=$(echo "$json" | jq -r '.prompt // .text // empty')
if [ -n "$content" ]; then
echo -e "\n\n---\n\n### Extracted Prompt\n$content" >> "$file"
echo " ✅ Appended extracted content to $file"
else
echo " ⚠️ No prompt text extracted for $link"
fi
done
done
- name: Commit and push results
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add prompts
git diff --cached --quiet && echo "No changes to commit." && exit 0
git commit -m "Auto-scraped Codex prompts"
git push