|
| 1 | +name: CodeBoarding Action for RIDE |
| 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/robotframework/RIDE' |
| 10 | + type: string |
| 11 | + source_branch: |
| 12 | + description: 'Source branch for comparison' |
| 13 | + required: false |
| 14 | + default: 'master' |
| 15 | + type: string |
| 16 | + target_branch: |
| 17 | + description: 'Target branch for comparison' |
| 18 | + required: false |
| 19 | + default: 'develop' |
| 20 | + type: string |
| 21 | + output_format: |
| 22 | + description: 'Output format for documentation' |
| 23 | + required: false |
| 24 | + default: '.md' |
| 25 | + type: string |
| 26 | + |
| 27 | + pull_request: |
| 28 | + branches: [ master, develop ] |
| 29 | + types: [opened, synchronize, reopened] |
| 30 | + |
| 31 | + schedule: |
| 32 | + # Run daily at 2 AM UTC |
| 33 | + - cron: '0 2 * * *' |
| 34 | + |
| 35 | +jobs: |
| 36 | + update-docs-action-usage: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + permissions: |
| 39 | + contents: write |
| 40 | + pull-requests: write |
| 41 | + timeout-minutes: 60 |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout repository |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + fetch-depth: 0 # Required to access branch history |
| 49 | + |
| 50 | + # Determine branches based on context |
| 51 | + - name: Set branch variables |
| 52 | + id: set-branches |
| 53 | + run: | |
| 54 | + if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 55 | + echo "source_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT |
| 56 | + echo "target_branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT |
| 57 | + elif [ "${{ github.event.inputs.source_branch }}" != "" ] && [ "${{ github.event.inputs.target_branch }}" != "" ]; then |
| 58 | + echo "source_branch=${{ github.event.inputs.source_branch }}" >> $GITHUB_OUTPUT |
| 59 | + echo "target_branch=${{ github.event.inputs.target_branch }}" >> $GITHUB_OUTPUT |
| 60 | + else |
| 61 | + # Default to current branch and main |
| 62 | + echo "source_branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT |
| 63 | + echo "target_branch=main" >> $GITHUB_OUTPUT |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Fetch CodeBoarding Documentation |
| 67 | + id: codeboarding |
| 68 | + uses: ./ |
| 69 | + with: |
| 70 | + repository_url: ${{ github.event.inputs.repository_url }} |
| 71 | + source_branch: ${{ steps.set-branches.outputs.source_branch }} |
| 72 | + target_branch: ${{ steps.set-branches.outputs.target_branch }} |
| 73 | + output_directory: 'doc/.codeboarding' |
| 74 | + output_format: ${{ github.event.inputs.output_format || '.md' }} |
| 75 | + |
| 76 | + - name: Display Action Results |
| 77 | + run: | |
| 78 | + echo "Documentation files created: ${{ steps.codeboarding.outputs.markdown_files_created }}" |
| 79 | + echo "JSON files created: ${{ steps.codeboarding.outputs.json_files_created }}" |
| 80 | + echo "Documentation directory: ${{ steps.codeboarding.outputs.output_directory }}" |
| 81 | + echo "JSON directory: ${{ steps.codeboarding.outputs.json_directory }}" |
| 82 | + echo "Has changes: ${{ steps.codeboarding.outputs.has_changes }}" |
| 83 | +
|
| 84 | + # Check if we have any changes to commit |
| 85 | + - name: Check for changes |
| 86 | + id: git-changes |
| 87 | + run: | |
| 88 | + if [ -n "$(git status --porcelain)" ]; then |
| 89 | + echo "has_git_changes=true" >> $GITHUB_OUTPUT |
| 90 | + else |
| 91 | + echo "has_git_changes=false" >> $GITHUB_OUTPUT |
| 92 | + fi |
| 93 | +
|
| 94 | + - name: Create Pull Request |
| 95 | + if: steps.git-changes.outputs.has_git_changes == 'true' && steps.codeboarding.outputs.has_changes == 'true' |
| 96 | + uses: peter-evans/create-pull-request@v5 |
| 97 | + with: |
| 98 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 99 | + commit-message: "docs: update codeboarding documentation" |
| 100 | + title: "📚 CodeBoarding Documentation Update" |
| 101 | + body: | |
| 102 | + ## 📚 Documentation Update |
| 103 | + |
| 104 | + This PR contains updated documentation files fetched from the CodeBoarding service. |
| 105 | + |
| 106 | + ### 📊 Summary |
| 107 | + - **Documentation files created/updated**: ${{ steps.codeboarding.outputs.markdown_files_created }} |
| 108 | + - **JSON files created/updated**: ${{ steps.codeboarding.outputs.json_files_created }} |
| 109 | + - **Documentation directory**: `${{ steps.codeboarding.outputs.output_directory }}/` |
| 110 | + - **JSON directory**: `${{ steps.codeboarding.outputs.json_directory }}/` |
| 111 | + - **Source branch**: `${{ steps.set-branches.outputs.source_branch }}` |
| 112 | + - **Target branch**: `${{ steps.set-branches.outputs.target_branch }}` |
| 113 | + - **Output format**: `${{ github.event.inputs.output_format || '.md' }}` |
| 114 | + - **Repository analyzed**: `${{ steps.codeboarding.outputs.repo_url }}` |
| 115 | + |
| 116 | + ### 🔍 Changes |
| 117 | + Files have been updated with fresh documentation content based on code changes between branches. |
| 118 | + |
| 119 | + --- |
| 120 | + |
| 121 | + 🤖 This PR was automatically generated by the CodeBoarding documentation update workflow. |
| 122 | + branch: docs/codeboarding-update |
| 123 | + base: ${{ steps.set-branches.outputs.target_branch }} |
| 124 | + delete-branch: true |
0 commit comments