add process docs changes workflow #22
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: Process Branches | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [trigger-workflow] | |
| jobs: | |
| checkout-docs-repo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout docs repository | |
| uses: actions/checkout@v4 | |
| caught-new-branch-name: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Display received payload | |
| run: | | |
| echo "Received branch name: ${{ github.event.client_payload.branch }}" | |
| # Add your workflow steps here based on the branch argument. | |
| process-branches: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up branches list | |
| id: branches | |
| run: echo "::set-output name=list::master release-x.53.x release-x.52.x release-x.51.x release-x.50.x release-x.49.x release-x.48.x release-x.47.x release-x.46.x release-x.45.x release-x.44.x release-x.43.x release-x.42.x release-x.41.x" | |
| - name: Process each branch | |
| run: | | |
| mkdir -p _docs | |
| for branch in ${{ steps.branches.outputs.list }}; do | |
| echo "Processing branch: $branch" | |
| git clone --depth 1 --branch $branch --filter=blob:none --no-checkout https://github.com/metabase/metabase.git temp_$branch | |
| cd temp_$branch | |
| git sparse-checkout init --cone | |
| git sparse-checkout set docs | |
| git checkout $branch | |
| mkdir -p ../_docs/$branch | |
| cp -r docs/. ../_docs/$branch/ | |
| cd .. | |
| rm -rf temp_$branch | |
| done | |
| - name: List _docs contents | |
| run: ls -altr _docs | |
| # # Optionally, commit and push if changes are expected: | |
| - name: view changes | |
| run: | | |
| ls _docs |