@@ -14,13 +14,13 @@ inputs:
1414outputs :
1515 ok :
1616 description : " If the command completed with a '0' exit code."
17- value : ${{ steps.slack-cli.outputs.ok }}
17+ value : ${{ steps.slack-cli-unix.outputs.ok || steps.slack-cli-windows .outputs.ok }}
1818 response :
1919 description : " The standard output from the CLI command."
20- value : ${{ steps.slack-cli.outputs.response }}
20+ value : ${{ steps.slack-cli-unix.outputs.response || steps.slack-cli-windows .outputs.response }}
2121 time :
2222 description : " The Unix epoch time that the step completed."
23- value : ${{ steps.slack-cli.outputs.time }}
23+ value : ${{ steps.slack-cli-unix.outputs.time || steps.slack-cli-windows .outputs.time }}
2424runs :
2525 using : composite
2626 steps :
8585 env :
8686 SLACK_CLI_VERSION : ${{ inputs.version }}
8787
88- - name : Run Slack CLI command
89- id : slack-cli
88+ - name : Run Slack CLI command (Linux/macOS)
89+ if : runner.os != 'Windows'
90+ id : slack-cli-unix
9091 shell : bash
9192 env :
9293 SLACK_COMMAND : ${{ inputs.command }}
@@ -115,3 +116,33 @@ runs:
115116 echo "::error::Slack CLI command failed with exit code $exit_code"
116117 exit $exit_code
117118 fi
119+
120+ - name : Run Slack CLI command (Windows)
121+ if : runner.os == 'Windows'
122+ id : slack-cli-windows
123+ shell : pwsh
124+ env :
125+ SLACK_COMMAND : ${{ inputs.command }}
126+ SLACK_TOKEN : ${{ inputs.token }}
127+ run : |
128+ $args = "$env:SLACK_COMMAND --skip-update"
129+ if ($env:SLACK_TOKEN) {
130+ $args = "$args --token $env:SLACK_TOKEN"
131+ }
132+
133+ $output = slack $args.Split(' ') 2>&1 | Out-String
134+ $exit_code = $LASTEXITCODE
135+
136+ Write-Output $output
137+
138+ "ok=$( if ($exit_code -eq 0) { 'true' } else { 'false' } )" >> $env:GITHUB_OUTPUT
139+ "time=$([DateTimeOffset]::UtcNow.ToUnixTimeSeconds())" >> $env:GITHUB_OUTPUT
140+
141+ "response<<SLACKCLIEOF" >> $env:GITHUB_OUTPUT
142+ $output >> $env:GITHUB_OUTPUT
143+ "SLACKCLIEOF" >> $env:GITHUB_OUTPUT
144+
145+ if ($exit_code -ne 0) {
146+ Write-Output "::error::Slack CLI command failed with exit code $exit_code"
147+ exit $exit_code
148+ }
0 commit comments