2727 node-version : ${{ matrix.node-version }}
2828
2929 - name : Determine if local
30- run : echo "IS_LOCAL=false " >> $GITHUB_ENV
30+ run : echo "IS_LOCAL=true " >> $GITHUB_ENV
3131
3232 - name : Fetch fork upstream
3333 if : ${{ env.IS_LOCAL == 'false' }}
@@ -36,28 +36,27 @@ jobs:
3636 git fetch forkUpstream # Fetch fork
3737
3838 - name : Determine base and target branches for comparison.
39- if : ${{ env.IS_LOCAL == 'false' }}
40- run : |
41- echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
42- echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
43-
44- - name : Determine base and target branches for comparison
45- if : ${{ env.IS_LOCAL == 'true' }}
4639 run : |
47- echo "CURRENT_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
48- echo "TARGET_BRANCH=master" >> $GITHUB_ENV
40+ if [ $IS_LOCAL == 'false']; then
41+ echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
42+ echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
43+ else
44+ echo "CURRENT_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
45+ echo "TARGET_BRANCH=master" >> $GITHUB_ENV
46+ fi
4947
5048 - name : Print base and target branches for comparison.
5149 run : |
5250 echo "CURRENT_BRANCH=$CURRENT_BRANCH"
5351 echo "TARGET_BRANCH=$TARGET_BRANCH"
54- - name : Compare target and current branches.
55- if : ${{ env.IS_LOCAL == 'false' }}
56- run : git diff origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
5752
5853 - name : Compare target and current branches.
59- if : ${{ env.IS_LOCAL == 'true' }}
60- run : git diff origin/$TARGET_BRANCH $CURRENT_BRANCH > diff_output.txt
54+ run : |
55+ if [ $IS_LOCAL == 'false']; then
56+ git diff origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
57+ else
58+ git diff origin/$TARGET_BRANCH $CURRENT_BRANCH > diff_output.txt
59+ fi
6160
6261 - run : npm install -g jscpd
6362
0 commit comments