init migration python sdk doc #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# yamllint disable rule:truthy rule:line-length | |
name: Sync Folders | |
on: | |
push: | |
branches: | |
- stable | |
paths: | |
- 'docs/docs/**' | |
- 'docs/sidebars.ts' | |
pull_request: | |
branches: | |
- stable | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source repository | |
uses: actions/checkout@v4 | |
with: | |
path: source-repo | |
- name: Checkout target repository | |
uses: actions/checkout@v4 | |
with: | |
repository: opsmill/infrahub-docs | |
token: ${{ secrets.PAT_TOKEN }} | |
path: target-repo | |
- name: Sync folders | |
run: | | |
rm -rf target-repo/docs/docs-python-sdk/* | |
rm -f target-repo/docs/sidebars-python-sdk.ts | |
cp -r source-repo/docs/docs/python-sdk/* target-repo/docs/docs-python-sdk | |
cp source-repo/docs/sidebars.ts target-repo/docs/sidebars-python-sdk.ts | |
for entry in source-repo/docs/docs/*; do | |
name=$(basename "$entry") | |
if [ "$name" != "python-sdk" ]; then | |
if [ -d "$entry" ]; then | |
cp -r "$entry"/* "target-repo/docs/docs/$name/" | |
elif [ -f "$entry" ]; then | |
cp "$entry" "target-repo/docs/docs/" | |
fi | |
fi | |
done | |
cd target-repo | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
if ! (git diff --quiet && git diff --staged --quiet); then git commit -m "Sync doc Python SDK from infrahub repo" && git push; fi |