Skip to content

Commit c71e1d7

Browse files
committed
Initial version of workflow integration
1 parent 50b5725 commit c71e1d7

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

.github/workflows/doc-updates.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: MCP Agent CodeBoarding Documentation Update
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repository_url:
7+
description: 'Repository URL to test with'
8+
required: false
9+
default: 'https://github.com/lastmile-ai/mcp-agent'
10+
type: string
11+
source_branch:
12+
description: 'Source branch for generation'
13+
required: false
14+
default: 'main'
15+
type: string
16+
target_branch:
17+
description: 'Target branch for pull request'
18+
required: false
19+
default: 'main'
20+
type: string
21+
output_format:
22+
description: 'Output format for documentation'
23+
required: false
24+
default: '.md'
25+
type: choice
26+
options:
27+
- '.md'
28+
- '.rst'
29+
output_directory:
30+
description: 'Output directory for documentation files'
31+
required: false
32+
default: 'docs/codeboarding'
33+
type: string
34+
35+
jobs:
36+
update-docs-action-usage:
37+
runs-on: ubuntu-latest
38+
timeout-minutes: 45
39+
permissions:
40+
contents: write
41+
pull-requests: write
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
with:
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
fetch-depth: 0 # Required to access branch history
48+
49+
# Determine branches based on context
50+
- name: Set branch variables
51+
id: set-branches
52+
run: |
53+
if [ "${{ github.event_name }}" = "pull_request" ]; then
54+
echo "source_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
55+
echo "target_branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
56+
elif [ "${{ github.event.inputs.source_branch }}" != "" ] && [ "${{ github.event.inputs.target_branch }}" != "" ]; then
57+
echo "source_branch=${{ github.event.inputs.source_branch }}" >> $GITHUB_OUTPUT
58+
echo "target_branch=${{ github.event.inputs.target_branch }}" >> $GITHUB_OUTPUT
59+
else
60+
echo "source_branch=main" >> $GITHUB_OUTPUT
61+
echo "target_branch=main" >> $GITHUB_OUTPUT
62+
fi
63+
64+
- name: Fetch CodeBoarding Documentation
65+
timeout-minutes: 30
66+
id: codeboarding
67+
uses: CodeBoarding/CodeBoarding-GHAction@v0.1.0
68+
with:
69+
repository_url: ${{ github.event.inputs.repository_url }}
70+
source_branch: ${{ steps.set-branches.outputs.source_branch }}
71+
target_branch: ${{ steps.set-branches.outputs.target_branch }}
72+
output_directory: ${{ github.event.inputs.output_directory || '.codeboarding' }}
73+
output_format: ${{ github.event.inputs.output_format || '.md' }}
74+
75+
- name: Display Action Results
76+
run: |
77+
echo "Documentation files created: ${{ steps.codeboarding.outputs.markdown_files_created }}"
78+
echo "JSON files created: ${{ steps.codeboarding.outputs.json_files_created }}"
79+
echo "Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}"
80+
echo "JSON directory: ${{ steps.codeboarding.outputs.json_directory }}"
81+
echo "Has changes: ${{ steps.codeboarding.outputs.has_changes }}"
82+
83+
# Check if we have any changes to commit
84+
- name: Check for changes
85+
id: git-changes
86+
run: |
87+
if [ -n "$(git status --porcelain)" ]; then
88+
echo "has_git_changes=true" >> $GITHUB_OUTPUT
89+
else
90+
echo "has_git_changes=false" >> $GITHUB_OUTPUT
91+
fi
92+
93+
- name: Create Pull Request
94+
if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true'
95+
uses: peter-evans/create-pull-request@v5
96+
with:
97+
token: ${{ secrets.PAT_TOKEN }}
98+
commit-message: "docs: update mcp-agent codeboarding documentation"
99+
title: "📚 MCP Agent CodeBoarding Documentation Update"
100+
body: |
101+
## 📚 MCP Agent Documentation Update
102+
This PR contains updated documentation files for the MCP Agent project fetched from the CodeBoarding service.
103+
104+
### 📊 Summary
105+
- **Documentation files created/updated**: ${{ steps.codeboarding.outputs.markdown_files_created }}
106+
- **JSON files created/updated**: ${{ steps.codeboarding.outputs.json_files_created }}
107+
- **Documentation directory**: `${{ steps.codeboarding.outputs.output_directory }}/`
108+
- **JSON directory**: `${{ steps.codeboarding.outputs.json_directory }}/`
109+
- **Output format**: `${{ github.event.inputs.output_format || '.md' }}`
110+
- **Repository analyzed**: `${{ steps.codeboarding.outputs.repo_url }}`
111+
112+
🤖 This PR was automatically generated by the MCP Agent CodeBoarding documentation update workflow.
113+
branch: docs/codeboarding-update
114+
base: main
115+
delete-branch: true

0 commit comments

Comments
 (0)