Example Usage of CodeBoarding Action #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Example Usage of CodeBoarding Action | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| repository_url: | |
| description: 'Repository URL to test with' | |
| required: false | |
| default: 'https://github.com/microsoft/markitdown' | |
| type: string | |
| source_branch: | |
| description: 'Source branch for comparison' | |
| required: false | |
| default: 'main' | |
| type: string | |
| target_branch: | |
| description: 'Target branch for comparison' | |
| required: false | |
| default: 'develop' | |
| type: string | |
| output_format: | |
| description: 'Output format for documentation' | |
| required: false | |
| default: '.md' | |
| type: choice | |
| options: | |
| - '.md' | |
| - '.rst' | |
| pull_request: | |
| branches: [ main, master ] | |
| types: [opened, synchronize, reopened] | |
| schedule: | |
| # Run daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| jobs: | |
| update-docs-action-usage: | |
| runs-on: ubuntu-latest | |
| 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 | |
| # Default to current branch and main | |
| echo "source_branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| echo "target_branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Fetch CodeBoarding Documentation | |
| id: codeboarding | |
| uses: ./ | |
| 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: 'docs' | |
| output_format: ${{ github.event.inputs.output_format || '.md' }} | |
| - 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 | |
| - name: Create Pull Request | |
| if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "docs: update codeboarding documentation" | |
| title: "π CodeBoarding Documentation Update" | |
| body: | | |
| ## π Documentation Update | |
| This PR contains updated documentation files fetched from the CodeBoarding service. | |
| ### π 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 }}/` | |
| - **Source branch**: `${{ steps.set-branches.outputs.source_branch }}` | |
| - **Target branch**: `${{ steps.set-branches.outputs.target_branch }}` | |
| - **Output format**: `${{ github.event.inputs.output_format || '.md' }}` | |
| - **Repository analyzed**: `${{ steps.codeboarding.outputs.repo_url }}` | |
| ### π Changes | |
| Files have been updated with fresh documentation content based on code changes between branches. | |
| --- | |
| π€ This PR was automatically generated by the CodeBoarding documentation update workflow. | |
| branch: docs/codeboarding-update | |
| base: ${{ steps.set-branches.outputs.target_branch }} | |
| delete-branch: true |