Skip to content
Draft
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
93d67eb
Add CI automation for automatic Beman docs import
Dec 9, 2025
fc5c628
Tweaks
Dec 9, 2025
e428d0f
Tweaks
Dec 9, 2025
4310530
Tweaks
Dec 9, 2025
2d55b53
Tweaks
Dec 9, 2025
9f8201a
Test: Add PR testing support to sync-docs workflow
Jan 19, 2026
a9c4250
Add test mode for PR creation in sync-docs workflow
Jan 19, 2026
05d5b68
Use unique branch name format: website-weekly-docs-import-yyyy-mm-dd
Jan 19, 2026
3c0411a
Fix: Clean up beman directory and handle PR permission limitations
Jan 19, 2026
8b2cff9
Add workflow_dispatch input for test mode
Jan 19, 2026
ac9553a
Add debug info and repository settings check for workflow_dispatch
Jan 19, 2026
eacee61
Add support for Personal Access Token (PAT) to fix permission issues
Jan 19, 2026
9f02335
Improve PAT detection and instructions
Jan 19, 2026
b687a4f
Add better PAT detection and error messages
Jan 19, 2026
be37714
Clean up workflow: remove test/debug code, keep only production funct…
Jan 19, 2026
4d8fd67
Add back Show changes step with git status and git diff
Jan 19, 2026
11bccda
Add back pull_request trigger so workflow runs on PRs
Jan 19, 2026
50e26b5
Allow PR creation on PRs when PAT is available
Jan 19, 2026
54f5d12
Add repository_dispatch trigger for on-demand API triggering
Jan 19, 2026
bc70e5e
Update .github/workflows/sync-docs.yml
neatudarius Jan 19, 2026
cfc912d
Update .github/workflows/sync-docs.yml
neatudarius Jan 19, 2026
f075c11
Update .github/workflows/sync-docs.yml
neatudarius Jan 19, 2026
9889e4f
Add SPDX identifier
Jan 19, 2026
4a29520
Fail fatal if PAT is missing when running on PRs
Jan 19, 2026
b393851
Add comprehensive debug section before Create Pull Request step
Jan 19, 2026
ee01cd9
Trigger workflow run
Jan 19, 2026
9721372
Move debug section earlier in workflow (after branch name generation)
Jan 19, 2026
c019525
Move Show changes step right after Generate branch name
Jan 19, 2026
03acade
Trigger workflow run to test GH_PAT
Jan 19, 2026
48033e2
Re-test workflow with GH_PAT secret
Jan 19, 2026
adbaa04
Trigger workflow run again
Jan 19, 2026
9bb9c56
Trigger workflow run
Jan 19, 2026
ee0dc4c
Update PR title to include date and review request
Jan 19, 2026
72d7bf2
Update PR: set assignee to neatudarius, add reviewers, and link to is…
Jan 19, 2026
1544255
Fix issue reference text: 'automatic docs import'
Jan 19, 2026
906bee9
Change 'Evergreen' to 'evergreen' (lowercase)
Jan 19, 2026
ed9c751
Simplify workflow: keep only schedule trigger, remove manual triggers…
Jan 19, 2026
692aef4
Add comprehensive documentation explaining workflow purpose, schedule…
Jan 19, 2026
e8494e6
Optimize checkout: change fetch-depth from 0 to 1 for better performance
Jan 19, 2026
5fd264f
Remove unnecessary cleanup step - GitHub Actions runners auto-cleanup…
Jan 19, 2026
29d3785
Make error message more generic: clarify repository Settings location
Jan 19, 2026
7adddaa
Make assignees and reviewers configurable via repository variables wi…
Jan 19, 2026
5d59528
Add workflow_dispatch and repository_dispatch triggers for manual tes…
Jan 19, 2026
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
188 changes: 188 additions & 0 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Auto-sync Beman Documentation Workflow
#
# Purpose:
# This workflow automatically synchronizes documentation and images from the
# bemanproject/beman repository to the website repository. It ensures that
# the website always has the latest documentation content without manual
# intervention.
#
# When it runs:
# - Weekly on Mondays at 6:00 AM UTC (08:00–09:00 Romania time, depending on DST)
# - Runs automatically via GitHub Actions schedule (cron)
# - Can be triggered manually via workflow_dispatch (Actions tab → Run workflow)
# - Can be triggered via API using repository_dispatch with type "sync-docs"
#
# What it does:
# 1. Clones both the website and beman repositories
# 2. Runs the sync-docs.py script to copy documentation files and images
# 3. Cleans up temporary files (removes beman directory)
# 4. Creates a new branch with format: website-weekly-docs-import-YYYY-MM-DD
# 5. Creates a pull request with the synced changes
#
# Credentials:
# - Uses GITHUB_TOKEN (automatically provided by GitHub Actions)
# - The token has contents:write and pull-requests:write permissions
#
# Expected output:
# - A pull request titled: "Beman website weekly sync import (YYYY-MM-DD) - please review"
# - PR is assigned to neatudarius
# - PR has reviewers: neatudarius, RaduNichita, mguludag
# - PR is linked to issue #125 (evergreen issue: automatic docs import)
# - PR contains all synced documentation changes from bemanproject/beman

name: Auto-sync Beman Docs

on:
schedule:
- cron: '0 6 * * MON' # 08:00–09:00 Romania time (depending on DST)
workflow_dispatch: # Manual trigger for testing
repository_dispatch: # API trigger for on-demand runs
types:
- sync-docs

permissions:
contents: write
pull-requests: write

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Checkout website repo
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Checkout beman repo
uses: actions/checkout@v4
with:
repository: bemanproject/beman
path: beman

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Run sync-docs.py
run: |
python3 scripts/sync-docs.py beman

- name: Generate branch name
id: branch-name
run: |
DATE_STR=$(date +%Y-%m-%d)
BRANCH_NAME="website-weekly-docs-import-$DATE_STR"
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "date_str=$DATE_STR" >> $GITHUB_OUTPUT
echo "Generated branch name: $BRANCH_NAME"

- name: Show changes
run: |
echo "=== Changes detected ==="
git status
echo ""
echo "=== Diff ==="
git diff || echo "No changes detected"

- name: Debug workflow context and permissions
run: |
echo "=== Workflow Debug Information ==="
echo ""
echo "Event Information:"
echo " Event name: ${{ github.event_name }}"
echo " Ref: ${{ github.ref }}"
echo " Head ref: ${{ github.head_ref }}"
echo " Base ref: ${{ github.base_ref }}"
echo " SHA: ${{ github.sha }}"
echo ""
echo "Repository Information:"
echo " Repository: ${{ github.repository }}"
echo " Actor: ${{ github.actor }}"
echo " Workflow: ${{ github.workflow }}"
echo " Run ID: ${{ github.run_id }}"
echo " Run number: ${{ github.run_number }}"
echo ""
echo "Branch Information:"
echo " Generated branch: ${{ steps.branch-name.outputs.branch_name }}"
echo " Base branch: main"
echo ""
echo "Token Information:"
GH_PAT_VALUE="${{ secrets.GH_PAT }}"
if [ -n "$GH_PAT_VALUE" ] && [ "$GH_PAT_VALUE" != "" ]; then
echo " Token type: GH_PAT (Personal Access Token)"
echo " Token available: ✅ Yes"
echo " Token length: ${#GH_PAT_VALUE} characters"
else
echo " Token type: GITHUB_TOKEN"
echo " Token available: ⚠️ Limited permissions on PRs"
echo " GH_PAT secret: ❌ Not found or empty"
echo " Note: Add GH_PAT secret in repository Settings under Secrets and variables > Actions"
fi
echo ""
echo "Permissions:"
echo " Contents: write"
echo " Pull requests: write"
echo ""
echo "Git Status:"
git status --short || echo " (no changes or git error)"
echo ""
echo "=== End Debug Information ==="

- name: Prepare PR assignees and reviewers
id: pr-people
run: |
# Use repository variables if set, otherwise fall back to hardcoded defaults.
# These users are hardcoded as the primary website maintainers responsible
# for reviewing documentation sync PRs. If team membership changes, update
# repository variables DOC_SYNC_ASSIGNEES and DOC_SYNC_REVIEWERS instead of
# modifying this workflow file.
# Default assignee: neatudarius (primary website maintainer)
# Default reviewers: neatudarius, RaduNichita, mguludag (website maintainers)
# Get assignees and reviewers from vars or use defaults
if [ -n "${{ vars.DOC_SYNC_ASSIGNEES }}" ]; then
ASSIGNEES="${{ vars.DOC_SYNC_ASSIGNEES }}"
else
ASSIGNEES="neatudarius"
fi

if [ -n "${{ vars.DOC_SYNC_REVIEWERS }}" ]; then
REVIEWERS="${{ vars.DOC_SYNC_REVIEWERS }}"
else
REVIEWERS="neatudarius
RaduNichita
mguludag"
fi

echo "assignees<<EOF" >> $GITHUB_OUTPUT
echo "$ASSIGNEES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "reviewers<<EOF" >> $GITHUB_OUTPUT
echo "$REVIEWERS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "Using assignees: $ASSIGNEES"
echo "Using reviewers: $REVIEWERS"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
base: main
commit-message: "Auto-sync documentation from latest content of bemanproject/beman"
branch: ${{ steps.branch-name.outputs.branch_name }}
title: "Beman website weekly sync import (${{ steps.branch-name.outputs.date_str }}) - please review"
body: |
Automated sync of documentation and images from latest content of [bemanproject/beman](https://github.com/bemanproject/beman).

Related to: #125 - evergreen issue: automatic docs import
labels: |
sync
automation
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
assignees: ${{ steps.pr-people.outputs.assignees }}
reviewers: ${{ steps.pr-people.outputs.reviewers }}
Loading