|
46 | 46 | docs_repo_name="${orgName}_${repoName}" |
47 | 47 | echo "docs_repo_name=$docs_repo_name" >> $GITHUB_ENV |
48 | 48 |
|
| 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 | +
|
49 | 65 | - name: Check if repo exists |
50 | 66 | id: check-repo |
51 | 67 | run: | |
@@ -105,24 +121,4 @@ jobs: |
105 | 121 | git add . |
106 | 122 | git commit -m "Generate document for ${{ env.repoName }}" |
107 | 123 | 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