[SPARK-36164][INFRA][FOLLOWUP] Add empty string check back
[SPARK-36164][INFRA][FOLLOWUP] Add empty string check back

### What changes were proposed in this pull request?

This is a follow-up of #33371.
At the branch commit GitHub run, we have an empty environment variable.
This PR adds back the empty string check logic.

### Why are the changes needed?

Currently, the failure happens when we use `--modules` in GitHub Action.
```
$ GITHUB_ACTIONS=1 APACHE_SPARK_REF= dev/run-tests.py --modules core
[info] Using build tool sbt with Hadoop profile hadoop3.2 and Hive profile hive2.3 under environment github_actions
fatal: ambiguous argument '': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Traceback (most recent call last):
  File "/Users/dongjoon/APACHE/spark-merge/dev/run-tests.py", line 785, in <module>
    main()
  File "/Users/dongjoon/APACHE/spark-merge/dev/run-tests.py", line 663, in main
    changed_files = identify_changed_files_from_git_commits(
  File "/Users/dongjoon/APACHE/spark-merge/dev/run-tests.py", line 91, in identify_changed_files_from_git_commits
    raw_output = subprocess.check_output(['git', 'diff', '--name-only', patch_sha, diff_target],
  File "/Users/dongjoon/.pyenv/versions/3.9.5/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/dongjoon/.pyenv/versions/3.9.5/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'diff', '--name-only', 'HEAD', '']' returned non-zero exit status 128.
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manually. The following failure is correct in local environment because it passed `identify_changed_files_from_git_commits` already.
```
$ GITHUB_ACTIONS=1 APACHE_SPARK_REF= dev/run-tests.py --modules core
[info] Using build tool sbt with Hadoop profile hadoop3.2 and Hive profile hive2.3 under environment github_actions
Traceback (most recent call last):
  File "/Users/dongjoon/APACHE/spark-merge/dev/run-tests.py", line 785, in <module>
    main()
  File "/Users/dongjoon/APACHE/spark-merge/dev/run-tests.py", line 668, in main
    os.environ["GITHUB_SHA"], target_ref=os.environ["GITHUB_PREV_SHA"])
  File "/Users/dongjoon/.pyenv/versions/3.9.5/lib/python3.9/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'GITHUB_SHA'
```

Closes #33374 from dongjoon-hyun/SPARK-36164.

Authored-by: Dongjoon Hyun <6ff48b33cbb828151035af58a92f18a39f1d1036@apache.org>
Signed-off-by: Dongjoon Hyun <6ff48b33cbb828151035af58a92f18a39f1d1036@apache.org>

ueshin/apache-spark,chuckchen/spark,WeichenXu123/spark,taroplus/spark,jiangxb1987/spark,jiangxb1987/spark,zzcclp/spark,rednaxelafx/apache-spark,gengliangwang/spark,HyukjinKwon/spark,witgo/spark,zero323/spark,WeichenXu123/spark,nchammas/spark,dongjoon-hyun/spark,witgo/spark,JoshRosen/spark,HyukjinKwon/spark,vinodkc/spark,cloud-fan/spark,wangyum/spark,mahak/spark,vinodkc/spark,zero323/spark,ueshin/apache-spark,HyukjinKwon/spark,vinodkc/spark,gengliangwang/spark,vinodkc/spark,apache/spark,dongjoon-hyun/spark,HyukjinKwon/spark,rednaxelafx/apache-spark,hvanhovell/spark,dongjoon-hyun/spark,jiangxb1987/spark,wangyum/spark,holdenk/spark,gengliangwang/spark,apache/spark,apache/spark,shaneknapp/spark,apache/spark,witgo/spark,HyukjinKwon/spark,ueshin/apache-spark,zzcclp/spark,chuckchen/spark,xuanyuanking/spark,vinodkc/spark,witgo/spark,zero323/spark,srowen/spark,mahak/spark,mahak/spark,hvanhovell/spark,zzcclp/spark,nchammas/spark,shaneknapp/spark,ueshin/apache-spark,xuanyuanking/spark,HyukjinKwon/spark,shaneknapp/spark,nchammas/spark,WeichenXu123/spark,shaneknapp/spark,cloud-fan/spark,ueshin/apache-spark,WeichenXu123/spark,jiangxb1987/spark,xuanyuanking/spark,jiangxb1987/spark,holdenk/spark,wangyum/spark,cloud-fan/spark,zzcclp/spark,mahak/spark,JoshRosen/spark,dongjoon-hyun/spark,gengliangwang/spark,zero323/spark,holdenk/spark,taroplus/spark,zzcclp/spark,hvanhovell/spark,HyukjinKwon/spark,apache/spark,holdenk/spark,witgo/spark,mahak/spark,chuckchen/spark,rednaxelafx/apache-spark,dongjoon-hyun/spark,wangyum/spark,shaneknapp/spark,hvanhovell/spark,gengliangwang/spark,apache/spark,xuanyuanking/spark,apache/spark,zero323/spark,nchammas/spark,taroplus/spark,rednaxelafx/apache-spark,JoshRosen/spark,mahak/spark,holdenk/spark,wangyum/spark,srowen/spark,chuckchen/spark,taroplus/spark,vinodkc/spark,gengliangwang/spark,zero323/spark,chuckchen/spark,ueshin/apache-spark,dongjoon-hyun/spark,gengliangwang/spark,nchammas/spark,shaneknapp/spark,vinodkc/spark,wangyum/spark,JoshRosen/spark,srowen/spark,rednaxelafx/apache-spark,dongjoon-hyun/spark,witgo/spark,chuckchen/spark,hvanhovell/spark,jiangxb1987/spark,ueshin/apache-spark,zero323/spark,WeichenXu123/spark,srowen/spark,cloud-fan/spark,srowen/spark,zzcclp/spark,hvanhovell/spark,JoshRosen/spark,JoshRosen/spark,srowen/spark,cloud-fan/spark,taroplus/spark,taroplus/spark,cloud-fan/spark,xuanyuanking/spark,xuanyuanking/spark,nchammas/spark,nchammas/spark,zzcclp/spark,wangyum/spark,rednaxelafx/apache-spark,xuanyuanking/spark,WeichenXu123/spark,chuckchen/spark,holdenk/spark,mahak/spark,cloud-fan/spark,hvanhovell/spark,witgo/spark,WeichenXu123/spark,srowen/spark,rednaxelafx/apache-spark,holdenk/spark,jiangxb1987/spark,JoshRosen/spark,shaneknapp/spark,taroplus/spark