-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
84 lines (72 loc) · 2.55 KB
/
action.yml
File metadata and controls
84 lines (72 loc) · 2.55 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 'Tron GitHub'
description: 'Generate Tron Light Cycles animations as SVG files from GitHub contribution data'
author: 'markpython86'
branding:
icon: 'zap'
color: 'blue'
inputs:
github_user_name:
description: 'GitHub username to generate the Tron animation for'
required: true
outputs:
description: 'List of SVG files to generate (one per line, with optional theme parameter)'
required: false
default: |
tron-light-cycles.svg
tron-light-cycles-dark.svg?theme=dark
github-token:
description: 'GitHub token for authentication (if needed)'
required: false
default: ${{ github.token }}
outputs:
generated-files:
description: 'List of generated SVG files'
value: ${{ steps.generate-svg.outputs.files }}
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
shell: bash
working-directory: ${{ github.action_path }}
- name: Build the CLI tool
run: npm run build
shell: bash
working-directory: ${{ github.action_path }}
- name: Generate SVG files
id: generate-svg
run: |
# Parse the outputs input to get the files to generate
echo "${{ inputs.outputs }}" | while IFS= read -r line; do
if [[ -n "$line" ]]; then
# Parse filename and theme
filename=$(echo "$line" | cut -d'?' -f1)
theme_param=$(echo "$line" | grep -o '?theme=.*' | cut -d'=' -f2 || echo "")
theme=${theme_param:-light}
echo "🎮 Generating $filename with theme: $theme"
# Generate the SVG file using the CLI tool from the action path
node "${{ github.action_path }}/dist/cli.js" generate-svg \
--user "${{ inputs.github_user_name }}" \
--output "$filename" \
--theme "$theme"
if [[ -f "$filename" ]]; then
echo "✅ Successfully generated $filename"
else
echo "❌ Failed to generate $filename"
fi
fi
done
# List generated files with proper multiline format
if ls *.svg 1> /dev/null 2>&1; then
echo "files<<EOF" >> $GITHUB_OUTPUT
ls -1 *.svg >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "files=" >> $GITHUB_OUTPUT
fi
echo "🏍️ Tron Light Cycles SVG generation complete!"
shell: bash