Skip to content

Commit db60a8d

Browse files
fabianofernandeszupfabiano.fernandes@stg.stackspot.com
andauthored
Fix action (#3)
* Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test * Fix action test --------- Co-authored-by: fabiano.fernandes@stg.stackspot.com <fabiano.fernandes@stg.stackspot.com>
1 parent 9af465f commit db60a8d

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

.github/workflows/action-test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ jobs:
1515
ubuntu:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Run test action without publish
19-
uses: stack-spot/workflow-github-action-publish-content@main
18+
- name: Run test action
19+
uses: stack-spot/cli-github-action-run-command@main
2020
with:
2121
client_id: ${{ secrets.CLIENT_ID }}
2222
client_key: ${{ secrets.CLIENT_KEY }}
2323
realm: ${{ secrets.REALM }}
2424
command_stk: "--version"
25+
26+
- name: Run test action again
27+
uses: stack-spot/cli-github-action-run-command@main
28+
with:
29+
client_id: ${{ secrets.CLIENT_ID }}
30+
client_key: ${{ secrets.CLIENT_KEY }}
31+
realm: ${{ secrets.REALM }}
32+
command_stk: ""

action.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ inputs:
1616
required: true
1717
command_stk:
1818
description: Command STK
19-
required: true
20-
default: '--version'
19+
required: false
20+
default: ''
2121

2222
runs:
2323
using: "composite"
@@ -26,15 +26,14 @@ runs:
2626
id: check_cli
2727
shell: bash
2828
run: |
29-
if command -v stk &> /dev/null
30-
then
29+
if [ -f "$HOME/.stk/bin/stk" ]; then
3130
echo "STK_INSTALLED=true" >> "$GITHUB_ENV"
3231
else
3332
echo "STK_INSTALLED=false" >> "$GITHUB_ENV"
3433
fi
3534
3635
- name: Download STK CLI
37-
if: steps.output.check_cli.stk_installed == 'false'
36+
if: env.STK_INSTALLED == 'false'
3837
shell: bash
3938
run: |
4039
curl \
@@ -48,16 +47,21 @@ runs:
4847
https://stk.stackspot.com/installer/linux/stk.deb
4948
5049
- name: Install STK CLI
51-
if: steps.output.check_cli.stk_installed == 'false'
50+
if: env.STK_INSTALLED == 'false'
5251
shell: bash
5352
run: |
5453
sudo dpkg --install /tmp/stk.deb || echo "Installation failed with exit code: $?"
5554
export PATH=$PATH:$HOME/.stk/bin
5655
57-
- name: Verify if cli was installed
56+
- name: Check if STK CLI Installed
57+
id: check_cli2
5858
shell: bash
5959
run: |
60-
dpkg -l | grep stk
60+
if [ -f "$HOME/.stk/bin/stk" ]; then
61+
echo "STK_INSTALLED=true" >> "$GITHUB_ENV"
62+
else
63+
echo "STK_INSTALLED=false" >> "$GITHUB_ENV"
64+
fi
6165
6266
- name: Show STK CLI version
6367
shell: bash
@@ -81,5 +85,5 @@ runs:
8185
shell: bash
8286
if: ${{ failure() }}
8387
run: |
84-
cat $HOME/.stk/logs/*
88+
[ -d "$HOME/.stk/logs/" ] && [ "$(ls -A $HOME/.stk/logs/)" ] && cat $HOME/.stk/logs/*
8589
exit 1

0 commit comments

Comments
 (0)