-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
65 lines (60 loc) · 1.92 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
name: YouTube Action
description: GitHub action for YouTube, powered by yutu🐰
branding:
icon: cast
color: red
inputs:
version:
description: 'Version of the yutu binary to download'
required: false
default: ''
credential:
description: 'Base64 encoded credential to authenticate with the YouTube API'
required: true
token:
description: 'Base64 encoded token to authenticate with the YouTube API'
required: true
command:
description: 'Command to run, such as `video`, `channel` or `playlist`'
required: false
default: 'video'
subcommand:
description: 'Subcommand to run, such as `insert`, `update` or `list`'
required: false
default: ''
flags:
description: 'Flags passed to the command/subcommand'
required: false
default: ''
outputs:
response:
description: 'Response from the yutu command'
value: ${{ steps.run.outputs.response }}
runs:
using: composite
steps:
- uses: robinraju/release-downloader@v1.10
with:
repository: eat-pray-ai/yutu
latest: ${{ inputs.version == '' }}
tag: ${{ inputs.version }}
fileName: yutu-linux-amd64
- id: run
shell: bash
run: |
chmod +x yutu-linux-amd64
echo -n ${{ inputs.credential }} | base64 --decode > ./client_secret.json
echo -n ${{ inputs.token }} | base64 --decode > ./youtube.token.json
flags=$(echo ${{ inputs.flags }} | tr -d '\n')
if [[ $flags =~ "-o json" || $flags =~ "--output json" ]]; then
command="$command | jq -R"
./yutu-linux-amd64 ${{ inputs.command }} ${{ inputs.subcommand }} ${{ inputs.flags }} | jq 'tojson' > output
else
./yutu-linux-amd64 ${{ inputs.command }} ${{ inputs.subcommand }} ${{ inputs.flags }} > output
fi
cat output
{
echo "response<<EOF"
echo "$(cat output)"
echo "EOF"
} >> $GITHUB_OUTPUT