1+ name : CodeBoarding Documentation update workflow
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 20 * * 0' # Every Sunday at 8:00 PM UTC
6+ workflow_dispatch :
7+ inputs :
8+ repository_url :
9+ description : ' Repository URL to analyze'
10+ required : false
11+ default : ' https://github.com/praw-dev/praw'
12+ type : string
13+ source_branch :
14+ description : ' Source branch to analyze'
15+ required : false
16+ default : ' main'
17+ type : string
18+ target_branch :
19+ description : ' Target branch for documentation'
20+ required : false
21+ default : ' main'
22+ type : string
23+ output_directory :
24+ description : ' Output directory for documentation files'
25+ required : false
26+ default : ' .codeboarding'
27+ type : string
28+ output_format :
29+ description : ' Output format for documentation'
30+ required : false
31+ default : ' .md'
32+ type : choice
33+ options :
34+ - ' .md'
35+ - ' .mdx'
36+ - ' .rst'
37+ push :
38+ branches :
39+ - master
40+ - main
41+
42+ jobs :
43+ update-docs :
44+ runs-on : ubuntu-latest
45+ timeout-minutes : 45
46+ permissions :
47+ contents : write
48+ pull-requests : write
49+
50+ steps :
51+ - name : Checkout repository
52+ uses : actions/checkout@v4
53+ with :
54+ token : ${{ secrets.GITHUB_TOKEN }}
55+ fetch-depth : 0 # Required to access branch history
56+
57+ # Determine branches based on context
58+ - name : Set branch variables
59+ id : set-branches
60+ run : |
61+ if [ "${{ github.event.inputs.source_branch }}" != "" ] && [ "${{ github.event.inputs.target_branch }}" != "" ]; then
62+ echo "source_branch=${{ github.event.inputs.source_branch }}" >> $GITHUB_OUTPUT
63+ echo "target_branch=${{ github.event.inputs.target_branch }}" >> $GITHUB_OUTPUT
64+ echo "repository_url=${{ github.event.inputs.repository_url || format('https://github.com/{0}', github.repository) }}" >> $GITHUB_OUTPUT
65+ else
66+ echo "source_branch=main" >> $GITHUB_OUTPUT
67+ echo "target_branch=main" >> $GITHUB_OUTPUT
68+ echo "repository_url=https://github.com/${{ github.repository }}" >> $GITHUB_OUTPUT
69+ fi
70+
71+ - name : Fetch CodeBoarding Documentation
72+ timeout-minutes : 30
73+ id : codeboarding
74+ uses : CodeBoarding/CodeBoarding-GHAction@0.1.2
75+ with :
76+ repository_url : ${{ steps.set-branches.outputs.repository_url }}
77+ source_branch : ${{ steps.set-branches.outputs.source_branch }}
78+ target_branch : ${{ steps.set-branches.outputs.target_branch }}
79+ output_directory : ${{ github.event.inputs.output_directory || '.codeboarding' }}
80+ output_format : ${{ github.event.inputs.output_format || '.md' }}
81+
82+ - name : Display Action Results
83+ run : |
84+ echo "Documentation files created: ${{ steps.codeboarding.outputs.markdown_files_created }}"
85+ echo "JSON files created: ${{ steps.codeboarding.outputs.json_files_created }}"
86+ echo "Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}"
87+ echo "JSON directory: ${{ steps.codeboarding.outputs.json_directory }}"
88+ echo "Has changes: ${{ steps.codeboarding.outputs.has_changes }}"
89+
90+ # Check if we have any changes to commit
91+ - name : Check for changes
92+ id : git-changes
93+ run : |
94+ if [ -n "$(git status --porcelain)" ]; then
95+ echo "has_git_changes=true" >> $GITHUB_OUTPUT
96+ else
97+ echo "has_git_changes=false" >> $GITHUB_OUTPUT
98+ fi
99+
100+ - name : Commit and push changes
101+ if : steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true'
102+ run : |
103+ git config --local user.email "action@github.com"
104+ git config --local user.name "GitHub Action"
105+ git add .
106+ git commit -m "docs: update codeboarding documentation
107+
108+ ## 📚 Documentation Update
109+ This commit contains updated documentation files fetched from the CodeBoarding service.
110+
111+ ### 📊 Summary
112+ - Documentation files created/updated: ${{ steps.codeboarding.outputs.markdown_files_created }}
113+ - JSON files created/updated: ${{ steps.codeboarding.outputs.json_files_created }}
114+ - Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}/
115+ - JSON directory: ${{ steps.codeboarding.outputs.json_directory }}/
116+ - Output format: ${{ github.event.inputs.output_format || '.md' }}
117+ - Repository analyzed: ${{ steps.set-branches.outputs.repository_url }}
118+ - Source branch: ${{ steps.set-branches.outputs.source_branch }}
119+ - Target branch: ${{ steps.set-branches.outputs.target_branch }}
120+
121+ 🤖 This commit was automatically generated by the CodeBoarding documentation update workflow."
122+ git push
0 commit comments