Skip to content

Commit db24d22

Browse files
authored
Update create-repo.yml
1 parent a39e110 commit db24d22

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

.github/workflows/create-repo.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ jobs:
4646
docs_repo_name="${orgName}_${repoName}"
4747
echo "docs_repo_name=$docs_repo_name" >> $GITHUB_ENV
4848
49+
- name: Clone the current repository and store workflow run states
50+
run: |
51+
git clone https://github.com/${{ github.repository }}.git
52+
cd ${{ github.repository }}
53+
if [ ! -f workflow_runs.json ]; then
54+
echo "[]" > workflow_runs.json
55+
fi
56+
workflow_run=$(jq -n --arg id "${{ github.run_id }}" --arg repoUrl "${{ github.event.inputs.repoUrl }}" --arg branchName "${{ github.event.inputs.branchName }}" --arg docs_repo_name "${{ env.docs_repo_name }}" --arg status "${{ job.status }}" --arg conclusion "${{ job.conclusion }}" --arg created_at "${{ github.event.created_at }}" '{id: $id, repoUrl: $repoUrl, branchName: $branchName, docs_repo_name: $docs_repo_name, status: $status, conclusion: $conclusion, created_at: $created_at}')
57+
jq ". += [$workflow_run]" workflow_runs.json > tmp.json && mv tmp.json workflow_runs.json
58+
git config --global user.email "[email protected]"
59+
git config --global user.name "code2docs-ai agent"
60+
git add workflow_runs.json
61+
git commit -m "Update workflow_runs.json"
62+
git push https://code2docs-ai:${{ secrets.MY_PAT }}@github.com/${{ github.repository }}.git main
63+
64+
4965
- name: Check if repo exists
5066
id: check-repo
5167
run: |
@@ -105,24 +121,4 @@ jobs:
105121
git add .
106122
git commit -m "Generate document for ${{ env.repoName }}"
107123
git push https://code2docs-ai:${{ secrets.MY_PAT }}@github.com/code2docs-ai/${{ env.docs_repo_name }}.git main
108-
109-
- name: Clone the current repository
110-
run: |
111-
git clone https://github.com/${{ github.repository }}.git
112-
cd ${{ github.repository }}
113-
114-
- name: Create or update workflow_runs.json
115-
run: |
116-
if [ ! -f workflow_runs.json ]; then
117-
echo "[]" > workflow_runs.json
118-
fi
119-
workflow_run=$(jq -n --arg id "${{ github.run_id }}" --arg repoUrl "${{ github.event.inputs.repoUrl }}" --arg branchName "${{ github.event.inputs.branchName }}" --arg docs_repo_name "${{ env.docs_repo_name }}" --arg status "${{ job.status }}" --arg conclusion "${{ job.conclusion }}" --arg created_at "${{ github.event.created_at }}" '{id: $id, repoUrl: $repoUrl, branchName: $branchName, docs_repo_name: $docs_repo_name, status: $status, conclusion: $conclusion, created_at: $created_at}')
120-
jq ". += [$workflow_run]" workflow_runs.json > tmp.json && mv tmp.json workflow_runs.json
121-
122-
- name: Commit and push workflow_runs.json
123-
run: |
124-
git config --global user.email "[email protected]"
125-
git config --global user.name "code2docs-ai agent"
126-
git add workflow_runs.json
127-
git commit -m "Update workflow_runs.json"
128-
git push https://code2docs-ai:${{ secrets.MY_PAT }}@github.com/${{ github.repository }}.git main
124+

0 commit comments

Comments
 (0)