Skip to content

Commit d18555f

Browse files
committed
fix: preserve .github folder when pushing to SDK repos
1 parent 5c6eb84 commit d18555f

1 file changed

Lines changed: 50 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,33 @@ jobs:
156156
157157
- name: Push to SDK repository
158158
if: ${{ !inputs.dry_run }}
159-
uses: cpina/github-action-push-to-another-repository@main
160159
env:
161160
SSH_DEPLOY_KEY: ${{ secrets.SDK_DEPLOY_KEY_PYTHON }}
162-
with:
163-
source-directory: 'xdk/python'
164-
destination-github-username: 'xdevplatform'
165-
destination-repository-name: 'xdk-python'
166-
target-branch: main
167-
commit-message: 'chore: update SDK to v${{ needs.prepare.outputs.python_version }}'
161+
run: |
162+
# Setup SSH
163+
mkdir -p ~/.ssh
164+
echo "$SSH_DEPLOY_KEY" > ~/.ssh/deploy_key
165+
chmod 600 ~/.ssh/deploy_key
166+
ssh-keyscan github.com >> ~/.ssh/known_hosts
167+
168+
# Clone SDK repo
169+
GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key" git clone git@github.com:xdevplatform/xdk-python.git /tmp/sdk-repo
170+
171+
# Preserve .github folder
172+
cp -r /tmp/sdk-repo/.github xdk/python/.github 2>/dev/null || true
173+
174+
# Copy generated files to SDK repo (preserve .git)
175+
rm -rf /tmp/sdk-repo/*
176+
cp -r xdk/python/* /tmp/sdk-repo/
177+
cp -r xdk/python/.* /tmp/sdk-repo/ 2>/dev/null || true
178+
179+
# Commit and push
180+
cd /tmp/sdk-repo
181+
git config user.name "github-actions[bot]"
182+
git config user.email "github-actions[bot]@users.noreply.github.com"
183+
git add -A
184+
git commit -m "chore: update SDK to v${{ needs.prepare.outputs.python_version }}" || echo "No changes"
185+
GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key" git push
168186
169187
- name: Summary
170188
run: |
@@ -224,15 +242,33 @@ jobs:
224242
225243
- name: Push to SDK repository
226244
if: ${{ !inputs.dry_run }}
227-
uses: cpina/github-action-push-to-another-repository@main
228245
env:
229246
SSH_DEPLOY_KEY: ${{ secrets.SDK_DEPLOY_KEY_TYPESCRIPT }}
230-
with:
231-
source-directory: 'xdk/typescript'
232-
destination-github-username: 'xdevplatform'
233-
destination-repository-name: 'xdk-typescript'
234-
target-branch: main
235-
commit-message: 'chore: update SDK to v${{ needs.prepare.outputs.typescript_version }}'
247+
run: |
248+
# Setup SSH
249+
mkdir -p ~/.ssh
250+
echo "$SSH_DEPLOY_KEY" > ~/.ssh/deploy_key
251+
chmod 600 ~/.ssh/deploy_key
252+
ssh-keyscan github.com >> ~/.ssh/known_hosts
253+
254+
# Clone SDK repo
255+
GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key" git clone git@github.com:xdevplatform/xdk-typescript.git /tmp/sdk-repo
256+
257+
# Preserve .github folder
258+
cp -r /tmp/sdk-repo/.github xdk/typescript/.github 2>/dev/null || true
259+
260+
# Copy generated files to SDK repo (preserve .git)
261+
rm -rf /tmp/sdk-repo/*
262+
cp -r xdk/typescript/* /tmp/sdk-repo/
263+
cp -r xdk/typescript/.* /tmp/sdk-repo/ 2>/dev/null || true
264+
265+
# Commit and push
266+
cd /tmp/sdk-repo
267+
git config user.name "github-actions[bot]"
268+
git config user.email "github-actions[bot]@users.noreply.github.com"
269+
git add -A
270+
git commit -m "chore: update SDK to v${{ needs.prepare.outputs.typescript_version }}" || echo "No changes"
271+
GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key" git push
236272
237273
- name: Summary
238274
run: |

0 commit comments

Comments
 (0)