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
name: Sync Files to Another Repo | |
on: | |
push: | |
branches: | |
- Thyme-DocTestBranch | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source repository | |
uses: actions/checkout@v4 | |
- name: Filter and copy .md files | |
run: | | |
mkdir -p temp-dir/objects temp-dir/static | |
find Assets/Docs/Object -name '*.md' -exec cp {} temp-dir/objects/ \; | |
find Assets/Docs/Static -name '*.md' -exec cp {} temp-dir/static/ \; | |
echo "Copied .md files to temp-dir/objects:" | |
ls temp-dir/objects | |
echo "Copied .md files to temp-dir/static:" | |
ls temp-dir/static | |
- name: Checkout target repository | |
uses: actions/checkout@v4 | |
with: | |
repository: AoTTG-2/CustomLogicDocumentation | |
token: ${{ secrets.CLDOC }} | |
ref: integration | |
path: target-repo | |
- name: Delete existing files in target folders | |
run: | | |
rm -rf target-repo/reference/objects/* | |
rm -rf target-repo/reference/static/* | |
- name: Ensure target directories exist | |
run: | | |
mkdir -p target-repo/reference/objects | |
mkdir -p target-repo/reference/static | |
- name: Check target directories | |
run: | | |
echo "Contents of target-repo/reference/objects before copy:" | |
ls target-repo/reference/objects | |
echo "Contents of target-repo/reference/static before copy:" | |
ls target-repo/reference/static | |
- name: Copy files to target repository | |
run: | | |
cp -R temp-dir/objects/* target-repo/reference/objects/ | |
cp -R temp-dir/static/* target-repo/reference/static/ | |
- name: Check target directories after copy | |
run: | | |
echo "Contents of target-repo/reference/objects after copy:" | |
ls target-repo/reference/objects | |
echo "Contents of target-repo/reference/static after copy:" | |
ls target-repo/reference/static | |
- name: Commit and push changes | |
run: | | |
cd target-repo | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m "Sync .md files from source repo" | |
git push origin integration |