Skip to content

Commit 7e06c20

Browse files
committed
fix(setup-dependency): 为GitHub Action步骤添加缺失的shell声明
在多个运行步骤中显式指定shell类型,以确保在不同操作系统上正确执行命令。 同时统一错误输出方式,提升Windows环境下错误提示的一致性。
1 parent 948d5f6 commit 7e06c20

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/actions/setup-dependency/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ runs:
3232
echo "type=tar" >> $GITHUB_OUTPUT
3333
else
3434
echo "type=unknown" >> $GITHUB_OUTPUT
35+
shell: bash
3536

3637
- name: Handle git repository
3738
if: steps.source_type.outputs.type == 'git'
3839
run: |
3940
echo "Cloning git repository to ${{ inputs.dest }}"
4041
git clone ${{ inputs.source }} ${{ inputs.dest }}
42+
shell: bash
4143

4244
- name: Handle zip/tar on Linux/macOS
4345
if: steps.source_type.outputs.type != 'git' && runner.os != 'Windows'
@@ -52,18 +54,20 @@ runs:
5254
else
5355
echo "ERROR: Unknown archive type"
5456
exit 1
57+
shell: bash
5558

5659
- name: Handle zip on Windows
5760
if: steps.source_type.outputs.type == 'zip' && runner.os == 'Windows'
58-
shell: powershell
5961
run: |
6062
Write-Output "Downloading ${{ inputs.source }}"
6163
Invoke-WebRequest -Uri ${{ inputs.source }} -OutFile tmp_archive
6264
New-Item -ItemType Directory -Path ${{ inputs.dest }} -Force
6365
Expand-Archive tmp_archive -DestinationPath ${{ inputs.dest }} -Force
66+
shell: powershell
6467

6568
- name: Unsupported types on Windows
6669
if: steps.source_type.outputs.type != 'git' && steps.source_type.outputs.type != 'zip' && runner.os == 'Windows'
6770
run: |
68-
echo "ERROR: Only zip archives are supported on Windows for now"
71+
Write-Error "ERROR: Only zip archives are supported on Windows for now"
6972
exit 1
73+
shell: powershell

0 commit comments

Comments
 (0)