Process en branch #11
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
| # The name of this GH action | |
| name: Process en branch | |
| # Defines when this action should be run | |
| on: | |
| # Run on any Push | |
| push: | |
| branches: | |
| - en | |
| # Allow manual triggering | |
| workflow_dispatch: | |
| jobs: | |
| # A task that processes OpenAPI files from the en branch | |
| process-en-branch: | |
| # We run this on the latest ubuntu | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| node-version: [24.x] | |
| steps: | |
| - name: Check out scripts from main branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: refs/heads/main | |
| sparse-checkout: | | |
| .github/scripts | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check out api schemas from en branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: refs/heads/en | |
| path: openapi | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install script dependencies | |
| working-directory: .github/scripts | |
| run: npm install | |
| - name: Run add-code-samples script | |
| working-directory: .github/scripts | |
| run: npm run add-code-samples -- "../../openapi" "openapi.*\\.json" | |
| - name: Debug - show OpenAPI file changes before publish | |
| working-directory: openapi | |
| run: | | |
| echo "== Files in ./openapi (target of publish) ==" | |
| ls -la | |
| echo "" | |
| echo "== Git status (porcelain) ==" | |
| git status --porcelain || true | |
| echo "" | |
| echo "== Git diff (stat) ==" | |
| git diff --stat || true | |
| echo "" | |
| echo "== Git diff (names) ==" | |
| git diff --name-only || true | |
| echo "" | |
| echo "== SHA256 for openapi*.json (for quick comparison in logs) ==" | |
| shasum -a 256 openapi*.json || true | |
| - name: Push openapi directory to en-api-docs branch | |
| uses: s0/git-publish-subdir-action@v2.6.0 | |
| env: | |
| REPO: self | |
| BRANCH: en-api-docs | |
| FOLDER: openapi | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |