Skip to content

Update Developer Documentation #3

Update Developer Documentation

Update Developer Documentation #3

name: Update Developer Documentation
on:
schedule:
- cron: "0 3 * * *" # Daily at 3:00 AM UTC
workflow_dispatch:
jobs:
update-docs:
name: Update Developer Documentation
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: true
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Fetch Product Opener documentation
uses: actions/checkout@v4
with:
repository: openfoodfacts/openfoodfacts-server
path: temp-product-opener
sparse-checkout: |
docs
- name: Fetch Robotoff documentation
uses: actions/checkout@v4
with:
repository: openfoodfacts/robotoff
path: temp-robotoff
sparse-checkout: |
doc
- name: Fetch Infrastructure documentation
uses: actions/checkout@v4
with:
repository: openfoodfacts/openfoodfacts-infrastructure
ref: develop
path: temp-infrastructure
sparse-checkout: |
docs
- name: Fetch Open Prices documentation
uses: actions/checkout@v4
with:
repository: openfoodfacts/open-prices
path: temp-open-prices
sparse-checkout: |
docs
- name: Fetch Knowledge Panel documentation
uses: actions/checkout@v4
with:
repository: openfoodfacts/facets-knowledge-panels
path: temp-knowledge-panels
sparse-checkout: |
docs
- name: Fetch Search-a-licious documentation
uses: actions/checkout@v4
with:
repository: openfoodfacts/search-a-licious
path: temp-search-a-licious
sparse-checkout: |
docs
- name: Create docs directory structure
run: |
mkdir -p docs/product-opener
mkdir -p docs/robotoff
mkdir -p docs/infrastructure
mkdir -p docs/open-prices
mkdir -p docs/knowledge-panels
mkdir -p docs/search-a-licious
- name: Copy Product Opener documentation
run: |
if [ -d "temp-product-opener/docs" ]; then
cp -r temp-product-opener/docs/* docs/product-opener/
echo "Product Opener documentation copied successfully"
else
echo "Warning: Product Opener documentation not found"
fi
- name: Copy Robotoff documentation
run: |
if [ -d "temp-robotoff/doc" ]; then
cp -r temp-robotoff/doc/* docs/robotoff/
echo "Robotoff documentation copied successfully"
else
echo "Warning: Robotoff documentation not found"
fi
- name: Copy Infrastructure documentation
run: |
if [ -d "temp-infrastructure/docs" ]; then
cp -r temp-infrastructure/docs/* docs/infrastructure/
echo "Infrastructure documentation copied successfully"
else
echo "Warning: Infrastructure documentation not found"
fi
- name: Copy Open Prices documentation
run: |
if [ -d "temp-open-prices/docs" ]; then
cp -r temp-open-prices/docs/* docs/open-prices/
echo "Open Prices documentation copied successfully"
else
echo "Warning: Open Prices documentation not found"
fi
- name: Copy Knowledge Panel documentation
run: |
if [ -d "temp-knowledge-panels/docs" ]; then
cp -r temp-knowledge-panels/docs/* docs/knowledge-panels/
echo "Knowledge Panel documentation copied successfully"
else
echo "Warning: Knowledge Panel documentation not found"
fi
- name: Copy Search-a-licious documentation
run: |
if [ -d "temp-search-a-licious/docs" ]; then
cp -r temp-search-a-licious/docs/* docs/search-a-licious/
echo "Search-a-licious documentation copied successfully"
else
echo "Warning: Search-a-licious documentation not found"
fi
- name: Cleanup temporary directories
run: |
rm -rf temp-product-opener
rm -rf temp-robotoff
rm -rf temp-infrastructure
rm -rf temp-open-prices
rm -rf temp-knowledge-panels
rm -rf temp-search-a-licious
- name: Check for changes
id: git-check
run: |
git add .
if git diff --staged --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.git-check.outputs.changed == 'true'
run: |
git commit --no-verify -m "docs: update developer documentation from source repositories
Auto-generated synchronization from:
- openfoodfacts-server/docs
- robotoff/doc
- openfoodfacts-infrastructure/docs
- open-prices/docs
- facets-knowledge-panels/docs
- search-a-licious/docs
Updated at $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
git push origin main
- name: Summary
run: |
if [ "${{ steps.git-check.outputs.changed }}" == "true" ]; then
echo "Developer documentation updated successfully"
echo "Updated documentation from the following repositories:"
echo "- Product Opener: openfoodfacts/openfoodfacts-server/docs"
echo "- Robotoff: openfoodfacts/robotoff/doc"
echo "- Infrastructure: openfoodfacts/openfoodfacts-infrastructure/docs"
echo "- Open Prices: openfoodfacts/open-prices/docs"
echo "- Knowledge Panels: openfoodfacts/facets-knowledge-panels/docs"
echo "- Search-a-licious: openfoodfacts/search-a-licious/docs"
else
echo "No changes detected in developer documentation"
fi