Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
7940a10
Content Sync: Adding initial content conversion scripts and required …
vancura Feb 17, 2025
189c255
Content Sync: Adding final Prettier formatting
vancura Feb 17, 2025
131a56e
Content Sync: Removing HTML comments
vancura Feb 17, 2025
8f13393
Content Sync: Adding GitHub header
vancura Feb 17, 2025
fa90347
Content Sync: Fixing the bold parts
vancura Feb 17, 2025
f3174c7
ContentSync: Refactor project root determination
vancura Feb 17, 2025
a5b6b8a
Content Sync: Markup update
vancura Feb 17, 2025
96614b3
Content Sync: Markup update
vancura Feb 17, 2025
36d396a
Content Sync: Removing problematic enhance_italic_text()
vancura Feb 17, 2025
e551e3a
Content Sync: Remove all Picture elements
vancura Feb 17, 2025
f29034a
Content Sync: Markup update
vancura Feb 17, 2025
514355a
Content Sync: Transforming schema links
vancura Feb 17, 2025
4bfb3ca
Content Sync: Markup update
vancura Feb 17, 2025
b81e811
Content Sync: Markup update
vancura Feb 17, 2025
a8b1b82
Content Sync: Fixing Picture removal
vancura Feb 18, 2025
04642c7
Content Sync: Better logging
vancura Feb 18, 2025
20f4e33
Content Sync: Fixing schema links markup
vancura Feb 18, 2025
2f5c779
Content Sync: Minor cleanup
vancura Feb 18, 2025
46ac10d
Content Sync: Fixing ```` → ```
vancura Feb 18, 2025
34d6016
Content Sync: Markup update
vancura Feb 20, 2025
daf86bb
Content Sync: Process Astro blocks
vancura Feb 20, 2025
8a0f069
Content Sync: Documentation
vancura Feb 20, 2025
5cc155a
Content Sync: Reformat
vancura Feb 20, 2025
ac113e6
Content Sync: Adding the rest of Astro imports
vancura Feb 20, 2025
7836e7b
Content Sync: Removing all the comments from the output, after everyt…
vancura Feb 20, 2025
bdbdc95
Content Sync: Processing multiple markdown files
vancura Feb 20, 2025
d128558
Content Sync: Add file ignore functionality
vancura Feb 20, 2025
7124a3c
Content Sync: Markup update
vancura Feb 20, 2025
858b080
Content Sync: Adding missing Astro imports
vancura Feb 20, 2025
a806ca4
Content Sync: GitHub header now only in README (index.mdx)
vancura Feb 20, 2025
a3d9315
Content Sync: Add internal link transformation to MDX conversion
vancura Feb 20, 2025
b508599
Content Sync: Minor regex cleanups
vancura Feb 20, 2025
2af7a3e
Content Sync: Adding temporary branch processing, will remove
vancura Feb 20, 2025
0f2c476
Content Sync: Enhance sync workflow with error handling
vancura Feb 20, 2025
3442db8
Content Sync: Testing the action
vancura Feb 20, 2025
03b4189
Content Sync: Testing the action
vancura Feb 20, 2025
f454fbe
Content Sync: Testing the action
vancura Feb 20, 2025
f10f87f
Content Sync: Testing the action
vancura Feb 20, 2025
704151f
Content Sync: Temporary removal of the PR create step
vancura Feb 20, 2025
8ce51de
Content Sync: Adding the branch to the workflow
vancura Feb 20, 2025
177feea
Revert "Content Sync: Temporary removal of the PR create step"
vancura Feb 20, 2025
0a708ba
Content Sync: Trying the new token
vancura Feb 20, 2025
50e322f
Content Sync: Fix TODO regex
vancura Feb 20, 2025
944cd71
Content Sync: Testing the action
vancura Feb 20, 2025
067a8cf
Content Sync: Testing the action
vancura Feb 20, 2025
bd61eba
Content Sync: Testing the action
vancura Feb 20, 2025
dda4dbf
Content Sync: Testing the action
vancura Feb 20, 2025
9629744
Content Sync: Testing the action
vancura Feb 20, 2025
6b617f0
Content Sync: Testing the action
vancura Feb 20, 2025
9f6c406
Content Sync: Testing the action
vancura Feb 20, 2025
66d3465
Content Sync: Testing the action
vancura Feb 20, 2025
fc8f503
Content Sync: Testing the action
vancura Feb 20, 2025
fa131cf
Content Sync: Testing the action
vancura Feb 20, 2025
5db9aeb
Content Sync: Testing the action
vancura Feb 20, 2025
ce4ea1c
Content Sync: Testing the action
vancura Feb 20, 2025
5f71ff9
Content Sync: Testing the action
vancura Feb 20, 2025
24f3aff
Content Sync: Testing the action
vancura Feb 20, 2025
7423aeb
Content Sync: Testing the action
vancura Feb 20, 2025
b26c111
Content Sync: Testing the action
vancura Feb 20, 2025
80f048e
Content Sync: Testing the action
vancura Feb 20, 2025
ede680a
Content Sync: README.md TOC update
vancura Feb 21, 2025
6897c07
Content Sync: Rename `test-sync` to `sync` across project
vancura Feb 21, 2025
9ef6578
Content Sync: Testing the action
vancura Feb 21, 2025
a47d0f7
Content Sync: Testing the action
vancura Feb 21, 2025
23531fd
Content Sync: Testing the action
vancura Feb 21, 2025
af9ad6a
Content Sync: Testing the action
vancura Feb 21, 2025
e6d03c0
Content Sync: Testing the action
vancura Feb 21, 2025
8296c8f
Content Sync: Testing the action
vancura Feb 21, 2025
586d5e2
Content Sync: Testing the action
vancura Feb 21, 2025
0465365
Content Sync: Testing the action
vancura Feb 21, 2025
50d3910
Content Sync: Testing the action
vancura Feb 21, 2025
12241cd
Content Sync: Testing the action
vancura Feb 21, 2025
dc8f0a6
Content Sync: Testing the action
vancura Feb 21, 2025
a47dc16
Content Sync: Testing the action
vancura Feb 21, 2025
9f72424
Content Sync: Testing the action
vancura Feb 21, 2025
b5303fd
Content Sync: Testing the action
vancura Feb 21, 2025
68cf89d
Content Sync: Testing the action
vancura Feb 21, 2025
50e5097
Content Sync: Testing the action
vancura Feb 21, 2025
640125c
Content Sync: Testing the action
vancura Feb 21, 2025
b175471
Content Sync: Testing the action
vancura Feb 21, 2025
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
103 changes: 103 additions & 0 deletions .github/workflows/sync-to-astro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Sync Whitepaper to Astro (PR flow)

# Triggers on push to main when MD files or related assets change.
on:
push:
branches:
- main
- feat/gh-57-content-sync
paths:
- '*.md'
- 'pages/**/*.md'
- '.github/workflows/sync-to-astro.yml'
- 'scripts/**/*.py'
workflow_dispatch: # also allows manual trigger from GitHub UI

env:
TARGET_REPO: "apify/actor-whitepaper-web"
TARGET_BRANCH: "sync/whitepaper-updates"

jobs:
sync:
name: Sync Whitepaper to Astro (PR flow)
runs-on: ubuntu-latest
permissions:
contents: write # needed for pushing changes
pull-requests: write # needed for creating PRs

steps:
# Step 1: Clone the source repo (this repo).
- name: Checkout source repo
uses: actions/checkout@v4
with:
path: sync/source

# Step 2: Clone the target repo (Astro site).
- name: Checkout target repo
uses: actions/checkout@v4
with:
repository: ${{ env.TARGET_REPO }}
path: sync/target
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

# Step 3: Setup Python environment.
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: sync/source/requirements.txt

# Step 4: Install dependencies.
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r sync/source/requirements.txt
cp sync/source/package.json . && npm install

# Step 5: Run the MD to MDX conversion script.
- name: Run sync script
run: python sync/source/scripts/md2mdx.py --source sync/source --target sync/target

# Step 6: Create or update PR with changes.
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
run: |
cd sync/target
git status

# Create a unique branch name with timestamp.
BRANCH_NAME="sync/whitepaper-updates-$(date +%Y%m%d-%H%M%S)"
echo "Using branch: $BRANCH_NAME"

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

git checkout -b "$BRANCH_NAME"

# Only create PR if there are changes.
if [[ -n "$(git status --porcelain)" ]]; then
echo "Changes detected:"
git status --porcelain

git add .
git commit -m "sync: Update MDX content from Whitepaper"
if ! git push -f origin "$BRANCH_NAME"; then
echo "Failed to push changes"
exit 1
fi

# Create the PR using GitHub CLI.
gh pr create \
--title "sync: Update MDX content from Whitepaper" \
--body-file ../source/sync-pr-template.txt \
--base main \
--head "$BRANCH_NAME" \
--label "sync" \
--assignee ${{ github.actor }}
else
echo "No changes detected in git status --porcelain"
echo "Full directory contents of src/content/pages:"
ls -la src/content/pages/
fi
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
.idea
node_modules
package-lock.json
sync

# Python
.venv
__pycache__/
*.py[cod]
*$py.class
.Python
pip-log.txt
pip-delete-this-directory.txt
.pytest_cache/
Loading