-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
88 lines (80 loc) · 2.74 KB
/
action.yml
File metadata and controls
88 lines (80 loc) · 2.74 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
85
86
87
88
name: 'GitHub Profile Readme Postprocessor Action'
description: 'Automatically update your GitHub profile README with your recent activity and repository insights using a local Go server.'
author: 'leoweyr'
branding:
icon: 'layout'
color: 'blue'
inputs:
readme_template_path:
description: 'Path to the README template file.'
default: 'template/README.md'
required: false
github_token:
description: 'GitHub Token for API access'
required: true
sort_latest_activity_blocks:
description: 'Whether to sort the LATEST_ACTIVITY blocks in descending order by timestamp.'
required: false
default: 'false'
tasks:
description: 'JSON list of tasks. Each task defines an anchor, endpoint, and specific params. Example: [{"anchor": "<!-- REPOS -->", "endpoint": "/v1/contributed-repositories/markdown", "params": {"limit_count": 5}}]'
required: false
default: |
[
{
"anchor": "<!-- SUPPORT_INFO -->",
"endpoint": "/v1/support/markdown",
"params": {}
},
{
"anchor": "<!-- CONTRIBUTED_REPOS -->",
"endpoint": "/v1/contributed-repositories/markdown",
"params": {}
}
]
runs:
using: 'composite'
steps:
- name: Track Workflow Run
continue-on-error: true
shell: bash
run: |
curl -s "https://abacus.jasoncameron.dev/hit/leoweyr/github-profile-readme-postprocessor-usage" > /dev/null
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build and Start Server
shell: bash
env:
APP_GITHUB_TOKEN: ${{ inputs.github_token }}
APP_LISTEN_PORT: 8080
run: |
echo "Starting Go server..."
cd ${{ github.action_path }}
go run cmd/server/main.go &
SERVER_PID=$!
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
# Wait for server to be ready.
timeout 30 bash -c 'until curl -s http://localhost:8080/health > /dev/null; do sleep 1; done' || echo "Server failed to start"
- name: Install Python Dependencies
shell: bash
run: pip3 install -r ${{ github.action_path }}/scripts/requirements.txt
- name: Update README
shell: bash
env:
PYTHONPATH: ${{ github.action_path }}/scripts
run: |
python3 -m main \
--username "${{ github.repository_owner }}" \
--readme_template_path "${{ inputs.readme_template_path }}" \
--output "README.md" \
--sort_latest_activity_blocks "${{ inputs.sort_latest_activity_blocks }}" \
--tasks '${{ inputs.tasks }}'
- name: Stop Server
if: always()
shell: bash
run: |
if [ -n "$SERVER_PID" ]; then
kill $SERVER_PID || true
fi