forked from mcp-use/mcp-use
-
Notifications
You must be signed in to change notification settings - Fork 1
170 lines (150 loc) · 7.31 KB
/
docs-update.yml
File metadata and controls
170 lines (150 loc) · 7.31 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: CodeBoarding Documentation update workflow
on:
workflow_dispatch:
inputs:
repository_url:
description: 'Repository URL to test with'
required: false
default: 'https://github.com/CodeBoarding/mcp-use'
type: string
source_branch:
description: 'Source branch for generation'
required: false
default: 'main'
type: string
target_branch:
description: 'Target branch for pull request'
required: false
default: 'main'
type: string
output_format:
description: 'Output format for documentation'
required: false
default: '.mdx'
type: choice
options:
- '.mdx'
- '.md'
- '.rst'
output_directory:
description: 'Output directory for documentation files'
required: false
default: '.codeboarding'
type: string
jobs:
update-docs-action-usage:
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # Required to access branch history
# Determine branches based on context
- name: Set branch variables
id: set-branches
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "source_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
echo "target_branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event.inputs.source_branch }}" != "" ] && [ "${{ github.event.inputs.target_branch }}" != "" ]; then
echo "source_branch=${{ github.event.inputs.source_branch }}" >> $GITHUB_OUTPUT
echo "target_branch=${{ github.event.inputs.target_branch }}" >> $GITHUB_OUTPUT
else
echo "source_branch=main" >> $GITHUB_OUTPUT
echo "target_branch=main" >> $GITHUB_OUTPUT
fi
- name: Fetch CodeBoarding Documentation
timeout-minutes: 30
id: codeboarding
uses: CodeBoarding/CodeBoarding-GHAction@0.1.2
with:
repository_url: ${{ github.event.inputs.repository_url }}
source_branch: ${{ steps.set-branches.outputs.source_branch }}
target_branch: ${{ steps.set-branches.outputs.target_branch }}
output_directory: ${{ github.event.inputs.output_directory || '.codeboarding' }}
output_format: ${{ github.event.inputs.output_format || '.mdx' }}
- name: Display Action Results
run: |
echo "Documentation files created: ${{ steps.codeboarding.outputs.markdown_files_created }}"
echo "JSON files created: ${{ steps.codeboarding.outputs.json_files_created }}"
echo "Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}"
echo "JSON directory: ${{ steps.codeboarding.outputs.json_directory }}"
echo "Has changes: ${{ steps.codeboarding.outputs.has_changes }}"
# Check if we have any changes to commit
- name: Check for changes
id: git-changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "has_git_changes=true" >> $GITHUB_OUTPUT
else
echo "has_git_changes=false" >> $GITHUB_OUTPUT
fi
# Generate architecture.mdx from CodeBoarding files
- name: Generate architecture documentation
if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true'
run: |
# Create docs/development directory if it doesn't exist
mkdir -p docs/development
# Log the files found in the CodeBoarding directory
echo "📁 Scanning CodeBoarding directory for .mdx files..."
ls -la .codeboarding/ || echo "⚠️ CodeBoarding directory not found"
# Initialize the architecture.mdx file
echo "" > docs/development/architecture.mdx
# First, add on_boarding.mdx if it exists
if [ -f ".codeboarding/on_boarding.mdx" ]; then
echo "✅ Found and adding: on_boarding.mdx"
cat .codeboarding/on_boarding.mdx >> docs/development/architecture.mdx
echo "" >> docs/development/architecture.mdx
else
echo "ℹ️ on_boarding.mdx not found, skipping"
fi
# Count and log other .mdx files
other_files_count=0
# Then add all other .mdx files (excluding on_boarding.mdx)
for file in .codeboarding/*.mdx; do
if [ -f "$file" ] && [ "$(basename "$file")" != "on_boarding.mdx" ]; then
filename=$(basename "$file")
echo "✅ Found and adding: $filename"
echo "" >> docs/development/architecture.mdx
cat "$file" >> docs/development/architecture.mdx
echo "" >> docs/development/architecture.mdx
other_files_count=$((other_files_count + 1))
fi
done
# Summary logging
echo ""
echo "📊 Architecture generation summary:"
echo " - on_boarding.mdx: $([ -f ".codeboarding/on_boarding.mdx" ] && echo "included" || echo "not found")"
echo " - Other .mdx files: $other_files_count files processed"
echo " - Output: docs/development/architecture.mdx"
# Show final file size
if [ -f "docs/development/architecture.mdx" ]; then
file_size=$(wc -c < docs/development/architecture.mdx)
echo " - Final file size: $file_size bytes"
fi
echo "Architecture documentation generated at docs/development/architecture.mdx"
- name: Commit and push changes
if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "docs: update codeboarding documentation and generate architecture
## 📚 Documentation Update
This commit contains updated documentation files fetched from the CodeBoarding service and automatically generated architecture documentation.
### 📊 Summary
- Documentation files created/updated: ${{ steps.codeboarding.outputs.markdown_files_created }}
- JSON files created/updated: ${{ steps.codeboarding.outputs.json_files_created }}
- Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}/
- JSON directory: ${{ steps.codeboarding.outputs.json_directory }}/
- Output format: ${{ github.event.inputs.output_format || '.mdx' }}
- Repository analyzed: ${{ steps.codeboarding.outputs.repo_url }}
- Architecture documentation: docs/development/architecture.mdx (auto-generated)
The generated .mdx files have been automatically appended to the development documentation, and the architecture.mdx file has been generated from the CodeBoarding analysis files.
🤖 This commit was automatically generated by the CodeBoarding documentation update workflow."
git push