@@ -129,12 +129,17 @@ jobs:
129
129
git checkout -b "$desired_branch" # Create a new branch and switch to it
130
130
fi
131
131
132
+ -
uses :
webfactory/[email protected]
133
+ with :
134
+ ssh-private-key : ${{ secrets.SSH_DEPLOY_KEY }}
135
+
132
136
- name : Initiate diffs
137
+ id : create-diffs
133
138
run : |
134
139
# Source all the configuration values to load $languages, $types, and $exclude
135
140
source ../configMatrix/configMatrix.sh
136
141
137
- output_path="../output "
142
+ output_path="../outputs "
138
143
output_file="$output_path/output.txt"
139
144
140
145
mkdir -p "$output_path"
@@ -200,102 +205,17 @@ jobs:
200
205
done
201
206
done
202
207
203
-
204
- # - uses: webfactory/[email protected]
205
- # with:
206
- # ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
207
-
208
- - name : Clean the Differ repo
209
- run : |
210
- cd differ
211
- # Remove everything except the .git folder and it's contents.
212
- for i in `ls | grep -v ".git"` ; do rm -rf $i; done;
213
-
214
- - name : Delete .git of new-version
215
- run : |
216
- rm -rf new-version/.git
217
-
218
- - name : Copy everything inside new-version to differ
219
- run : |
220
- cp -r new-version/* differ
221
-
222
- - name : Commit everything in differ
223
- id : commit-new
224
- run : |
225
- git config --global user.email "[email protected] "
226
- git config --global user.name "Github actions test"
227
- cd differ
228
- git add -A || true && git commit -m "Automatic commit" || true
229
-
230
- - name : Switch to old version repo
231
- run : |
232
- cd differ
233
- desired_branch="${{ env.OLD_VERSION_BRANCH }}"
234
- # Check if the branch exists on the remote repository
235
- if git ls-remote --heads origin "$desired_branch" | grep -q "$desired_branch"; then
236
- echo "The branch $desired_branch already exists on the remote repository."
237
- git fetch origin "$desired_branch" # Fetch the branch from the remote
238
- git checkout "$desired_branch" # Switch to the existing branch
239
- else
240
- echo "The branch $desired_branch does not exist on the remote repository."
241
- git checkout -b "$desired_branch" # Create a new branch and switch to it
242
- fi
243
-
244
- - name : Clean the Differ repo
245
- run : |
246
- cd differ
247
- # Remove everything except the .git folder and it's contents.
248
- for i in `ls | grep -v ".git"` ; do rm -rf $i; done;
249
-
250
- - name : Delete .git of old-version
251
- run : |
252
- rm -rf old-version/.git
253
-
254
- - name : Copy everything inside new-version to differ
255
- run : |
256
- cp -r old-version/* differ
257
-
258
- - name : Commit everything in differ
259
- run : |
260
- git config --global user.email "[email protected] "
261
- git config --global user.name "Github actions test"
262
- cd differ
263
- git add -A || true && git commit -m "Automatic commit" || true
264
-
265
-
266
- - name : Check if the diff is non-empty
267
- id : check-is-diff-non-empty
268
- run : |
269
- cd differ
270
- if git diff --quiet ${{ env.OLD_VERSION_BRANCH }}..${{ env.NEW_VERSION_BRANCH }}; then
271
- result=0 # Diff is empty
208
+ if [ -s "$output_file" ]; then
209
+ echo "DIFF_IS_NON_EMPTY=1" >> $GITHUB_OUTPUT
272
210
else
273
- result=1 # Diff is not empty
211
+ echo "DIFF_IS_NON_EMPTY=0" >> $GITHUB_OUTPUT
274
212
fi
275
- echo "DIFF_IS_NON_EMPTY=$result" >> $GITHUB_OUTPUT
276
-
277
- - name : Push repos
278
- if : ${{ steps.check-is-diff-non-empty.outputs.DIFF_IS_NON_EMPTY == '1' }}
279
- id : push
280
- run : |
281
- cd differ
282
- git push --set-upstream origin ${{ env.OLD_VERSION_BRANCH }}
283
- echo "OLD_COMMIT_HASH=$(git rev-parse --short origin/${{ env.OLD_VERSION_BRANCH }})" >> $GITHUB_OUTPUT
284
- git checkout ${{ env.NEW_VERSION_BRANCH }}
285
- git push --set-upstream origin ${{ env.NEW_VERSION_BRANCH }}
286
- echo "NEW_COMMIT_HASH=$(git rev-parse --short origin/${{ env.NEW_VERSION_BRANCH }})" >> $GITHUB_OUTPUT
287
-
288
- - name : Write changes to common file
289
- if : ${{ steps.check-is-diff-non-empty.outputs.DIFF_IS_NON_EMPTY == '1' }}
290
- run : |
291
- mkdir outputs
292
- echo "- [${{ matrix.language }} ${{ matrix.type }}](https://github.com/${{ vars.DIFF_VIEW_USERNAME }}/${{ vars.DIFF_VIEW_REPO_NAME }}/compare/${{ steps.push.outputs.OLD_COMMIT_HASH }}..${{ steps.push.outputs.NEW_COMMIT_HASH }})" >> outputs/${{ matrix.type }}-${{ matrix.language }}.txt
293
213
294
214
- uses : actions/upload-artifact@v3
295
- if : ${{ steps.check-is-diff-non-empty .outputs.DIFF_IS_NON_EMPTY == '1' }}
215
+ if : ${{ steps.create-diffs .outputs.DIFF_IS_NON_EMPTY == '1' }}
296
216
with :
297
217
name : outputs
298
- path : outputs/*.txt
218
+ path : ../ outputs/*.txt
299
219
300
220
read-artifacts-and-comment :
301
221
name : Read the artifacts and comment
0 commit comments