Skip to content

Manual Sync Files on Merge #60

Manual Sync Files on Merge

Manual Sync Files on Merge #60

Workflow file for this run

name: Manual Sync Files on Merge
on:
pull_request:
branches:
- main
types: [closed]
workflow_dispatch:
env:
SOURCE_DIR: ./src/
TARGET_OWNER: larshinueber
TARGET_REPO: foo-space
TARGET_DIR: foo-space/docs/source/_src_getting_started/_src_examples/notebooks/
USER_NAME: github-actions
USER_EMAIL: [email protected]
jobs:
sync:
# if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
env:
BRANCH_NAME: man-repo-sync-${{ github.event_name == 'pull_request' && github.event.pull_request.number || 'dispatch' }}
GH_TOKEN: ${{ secrets.GH_PAT }}
steps:
- name: Checkout source repository
uses: actions/checkout@v4
- name: Checkout target repository
uses: actions/checkout@v4
with:
repository: ${{ env.TARGET_OWNER }}/${{ env.TARGET_REPO }}
token: ${{ secrets.GH_PAT }}
ref: main
path: ./${{ env.TARGET_REPO }}
- name: Create new branch
run: |
bash .github/scripts/checkout_branch.sh ${{ env.TARGET_REPO }} ${{ env.BRANCH_NAME }} ${{ env.USER_EMAIL }} ${{ env.USER_NAME }}
- name: Delete old files
run: |
rm -rf ${{ env.TARGET_DIR }}
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Copy new files
run: |
python .github/scripts/copy_notebooks.py ${{ env.SOURCE_DIR }} ${{ env.TARGET_DIR }}
- name: Push changes
run: |
bash .github/scripts/commit_and_push.sh ${{ env.TARGET_REPO }} ${{ env.BRANCH_NAME }}
- name: Create PR
run: |
bash .github/scripts/create_pr.sh ${{ env.TARGET_REPO }} ${{ env.BRANCH_NAME }}