@@ -21,10 +21,15 @@ jobs:
2121 with :
2222 repository : neurostuff/${{ matrix.sdk[0] }}
2323 path : ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
24+ # - name: Setup tmate session
25+ # uses: mxschmitt/action-tmate@v3
26+ # timeout-minutes: 45
2427 - name : Checkout reciprical branch
2528 run : |
2629 cd ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
27- git checkout ${{ github.base_ref }} 2>/dev/null || git checkout -b ${{ github.base_ref }}
30+ git fetch
31+ git ls-remote --exit-code --heads origin ${{ github.ref_name }} || git branch ${{ github.ref_name }}
32+ git checkout ${{ github.ref_name }}
2833 - name : Generate SDK
2934 run : |
3035 ./generate.sh ${{ matrix.sdk[0] }}
@@ -33,11 +38,16 @@ jobs:
3338 cd ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
3439 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
3540 git config --local user.name "github-actions[bot]"
36-
37- # check to see if there were any changes to the repository.
41+ git config --local --unset-all "http.https://github.com/.extraheader"
42+ # check to see if there were any changes to the repository and no branches made
3843 if [ -z $(git ls-files --other --exclude-standard --directory) ]; then
3944 echo "No files to be committed!"
45+ if [ -z $(git ls-remote --heads origin ${{ github.ref_name }}) ]; then
46+ git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.ref_name }}
47+ else
48+ echo "branch already exists and is up to date"
49+ fi
4050 else
4151 git commit -m "${{ github.sha }}" -a
42- git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.base_ref }}
52+ git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.ref_name }}
4353 fi
0 commit comments