Skip to content

Commit 63b28dc

Browse files
authored
Merge pull request #20 from code2docs-ai/ups216/improve-create-repo-3
Improve create-repo.yml by cloning the source from repoUrl at the end of the workflow
2 parents 234e7bf + 9e8ff07 commit 63b28dc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.github/workflows/create-repo.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,16 @@ jobs:
7575
git add README.md
7676
git commit -m "Add README.md"
7777
git push https://code2docs-ai:${{ secrets.MY_PAT }}@github.com/code2docs-ai/${{ env.docs_repo_name }}.git main
78+
79+
- name: Check if source_repo exists and delete it
80+
run: |
81+
if [ -d "source_repo" ]; then
82+
rm -rf source_repo
83+
fi
84+
85+
- name: Clone the source from repoUrl
86+
run: |
87+
git clone ${{ github.event.inputs.repoUrl }} source_repo
88+
cd source_repo
89+
git remote add new_repo https://code2docs-ai:${{ secrets.MY_PAT }}@github.com/code2docs-ai/${{ env.docs_repo_name }}.git
90+
git push new_repo ${{ github.event.inputs.branchName }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ To use this GitHub Action workflow, follow these steps:
2121
- If the repository exists, delete it before creating a new one.
2222
- Create a new repository in the current organization with the name `docs_repo_name` using the GitHub API.
2323
- Check if the local directory already exists and remove it if it exists before cloning the repository.
24+
- Clone the source from `repoUrl` at the end of the workflow.
2425

2526
### Example
2627

0 commit comments

Comments
 (0)