This repository was archived by the owner on Feb 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (79 loc) · 3.04 KB
/
Copy pathauto-update-docs.yml
File metadata and controls
90 lines (79 loc) · 3.04 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
name: Update Documentation
on:
workflow_call: {}
workflow_dispatch: {} # Manual trigger for testing
concurrency:
group: update-docs
cancel-in-progress: true
jobs:
update-docs:
name: Update ${{ matrix.manager }} docs
# Restrict to home repository and main branch only for security
if: github.repository == 'KemingHe/python-dependency-manager-companion-mcp-server' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write # Required: commit documentation updates
strategy:
max-parallel: 1 # Prevent commit conflicts
matrix:
include:
- manager: pip
repo: pypa/pip
docs_path: docs
target_dir: src/assets/pip
- manager: conda
repo: conda/conda
docs_path: docs
target_dir: src/assets/conda
- manager: poetry
repo: python-poetry/poetry
docs_path: docs
target_dir: src/assets/poetry
- manager: uv
repo: astral-sh/uv
docs_path: docs
target_dir: src/assets/uv
- manager: pixi
repo: prefix-dev/pixi
docs_path: docs
target_dir: src/assets/pixi
- manager: pdm
repo: pdm-project/pdm
docs_path: docs
target_dir: src/assets/pdm
steps:
- name: Checkout main repo
uses: actions/checkout@v4
- name: Checkout ${{ matrix.manager }} docs
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
sparse-checkout: |
${{ matrix.docs_path }}
path: temp-docs
- name: Copy documentation files
run: |
# Create target directory if not exist
mkdir -p ${{ matrix.target_dir }}
# Copy docs and preserve structure with metadata
cp -a temp-docs/${{ matrix.docs_path }}/* ${{ matrix.target_dir }}/
# Add metadata file with source info
cat > ${{ matrix.target_dir }}/_metadata.json << EOF
{
"source_repo": "${{ matrix.repo }}",
"docs_path": "${{ matrix.docs_path }}",
"updated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"commit_sha": "$(cd temp-docs && git rev-parse HEAD)"
}
EOF
- name: Clean non-documentation files
run: ./scripts/clean-assets.sh
shell: bash {0} # Avoid double -e flag since script already has -euo pipefail
- name: Pull latest changes by previous update-docs job
run: git pull origin main
- name: Auto commit changes to main
# Pin 3rd-party action to v6.0.1 commit hash released on 2025-06-11 to prevent supply chain attacks
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0
with:
commit_message: 'docs(src/assets/): update ${{ matrix.manager }} official documentation'
file_pattern: 'src/assets/${{ matrix.manager }}/*'