-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaction.yml
68 lines (61 loc) · 2.12 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
# action.yml
name: "Screenly"
description: "GitHub Actions for Screenly."
author: "Screenly, Inc"
branding:
icon: "code"
color: "purple"
inputs:
screenly_api_token:
description: "Your Screenly API token."
required: true
cli_commands:
description: "Your Screenly CLI command(s)."
required: true
print_cli_commands_output:
description: "Print the Screenly CLI command(s) output."
default: "true"
required: false
cli_version:
description: "Screenly CLI version."
default: "v1.0.3"
outputs:
cli_commands_response:
description: "The response from the Screenly CLI command(s)."
value: ${{ steps.run-cli.outputs.response }}
runs:
using: "composite"
steps:
- name: Download CLI
id: download-cli
run: |
pushd /tmp
wget -q -O screenly-cli.tar.gz \
"https://github.com/Screenly/cli/releases/download/${{ inputs.cli_version }}/screenly-cli-x86_64-unknown-linux-gnu.tar.gz"
tar xfz screenly-cli.tar.gz
chmod +x screenly
popd
shell: bash
- name: Run CLI
id: run-cli
continue-on-error: true
run: |
set -o pipefail
API_TOKEN=${{ inputs.screenly_api_token }} RUST_LOG=debug /tmp/screenly ${{ inputs.cli_commands }} >> /tmp/screenly_cli_command_output.txt
# Filter logs from github output, while still saving them as artifact. Filtered lines are like: 2024-10-16T13:16:13.974Z DEBUG [reqwest::connect] ...
grep -Ev '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z[[:space:]](DEBUG|INFO|WARNING|ERROR)' /tmp/screenly_cli_command_output.txt | tr '\n' ' ' > /tmp/command_cleaned_output.txt
echo "response=$(cat /tmp/command_cleaned_output.txt)" >> "$GITHUB_OUTPUT"
cat /tmp/command_cleaned_output.txt
shell: bash
- name: Upload artifacts of failed screenly cli command
uses: actions/upload-artifact@v4
with:
name: run-cli-output
path: |
/tmp/screenly_cli_command_output.txt
- name: Fail if cli command failed
shell: bash
if: ${{ steps.run-cli.outcome != 'success' }}
run: |
exit 1