From ec833be89103d669d31832c16233fea6d03a094e Mon Sep 17 00:00:00 2001 From: shanexi Date: Fri, 20 Sep 2024 14:49:32 +0800 Subject: [PATCH] ci: sync when push main --- .github/workflows/sync-open-source-main.yaml | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/sync-open-source-main.yaml diff --git a/.github/workflows/sync-open-source-main.yaml b/.github/workflows/sync-open-source-main.yaml new file mode 100644 index 00000000..06bfa3cc --- /dev/null +++ b/.github/workflows/sync-open-source-main.yaml @@ -0,0 +1,47 @@ +name: Sync open-source main + +on: + push: + branches: + - main + paths: + - "web/apps/web/**" + - "web/packages/**" + - ".github/**" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Get last commit author email + id: get_email + run: echo "COMMIT_AUTHOR_EMAIL=$(git log -n 1 --pretty=format:%ae)" >> $GITHUB_ENV + + - name: Test author email + run: echo "The commit author email is $COMMIT_AUTHOR_EMAIL" + + - name: Get last commit author name + id: get_name + run: echo "COMMIT_AUTHOR_NAME=$(git log -n 1 --pretty=format:%an)" >> $GITHUB_ENV + + - name: Test author name + run: echo "The commit author name is $COMMIT_AUTHOR_NAME" + + - uses: cpina/github-action-push-to-another-repository@main + env: + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + with: + source-directory: web + target-directory: web + destination-github-username: "myshell-ai" + destination-repository-name: "open-source" + target-branch: main + create-target-branch-if-needed: false + user-name: ${{ env.COMMIT_AUTHOR_NAME }} + user-email: ${{ env.COMMIT_AUTHOR_EMAIL }} + + - name: Test get variable exported by push-to-another-repository + run: echo $DESTINATION_CLONED_DIRECTORY