fix the CLI docs workflow #3
Workflow file for this run
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: Update LocalStack CLI Docs | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| # Run on the 15th of every month at 00:00 UTC | |
| - cron: "0 0 15 * *" | |
| workflow_dispatch: | |
| inputs: | |
| targetBranch: | |
| description: 'Target branch to create the PR against' | |
| required: false | |
| type: string | |
| default: 'main' | |
| env: | |
| TARGET_BRANCH: ${{ github.event.inputs.targetBranch || 'main' }} | |
| jobs: | |
| update-cli-docs: | |
| name: Update LocalStack CLI Docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout docs | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| path: docs | |
| ref: ${{ env.TARGET_BRANCH }} | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install LocalStack CLI | |
| run: | | |
| pip install localstack | |
| - name: Generate CLI documentation | |
| working-directory: docs | |
| run: | | |
| python3 scripts/generate_cli_docs.py | |
| env: | |
| LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} | |
| - name: Test | |
| working-directory: docs | |
| run: | | |
| cat src/content/docs/aws/tooling/localstack-cli.md | |
| - name: Check for changes | |
| id: check-for-changes | |
| working-directory: docs | |
| env: | |
| TARGET_BRANCH: ${{ env.TARGET_BRANCH }} | |
| run: | | |
| # Check if there are changed files | |
| # Check against the PR branch if it exists, otherwise against the target branch | |
| mkdir -p resources | |
| FILE_TO_CHECK="src/content/docs/aws/tooling/localstack-cli.md" | |
| (git diff --name-only origin/cli-docs-auto-updates "$FILE_TO_CHECK" 2>/dev/null || git diff --name-only "origin/$TARGET_BRANCH" "$FILE_TO_CHECK" 2>/dev/null) | tee resources/diff-check.log | |
| echo "diff-count=$(cat resources/diff-check.log | wc -l)" >> $GITHUB_OUTPUT | |
| cat resources/diff-check.log | |
| - name: Create PR | |
| uses: peter-evans/create-pull-request@v7 | |
| if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }} | |
| with: | |
| path: docs | |
| title: "Update LocalStack CLI Documentation" | |
| body: | | |
| Automated update of LocalStack CLI documentation. | |
| This PR was auto-generated by the `update-cli-docs` workflow which runs on the 15th of every month. | |
| **Changes include:** | |
| - Updated CLI command reference | |
| - Updated subcommand documentation | |
| - CLI version bump (if applicable) | |
| branch: "cli-docs-auto-updates" | |
| author: "LocalStack Bot <localstack-bot@users.noreply.github.com>" | |
| committer: "LocalStack Bot <localstack-bot@users.noreply.github.com>" | |
| commit-message: "update generated LocalStack CLI docs" | |
| token: ${{ secrets.PRO_ACCESS_TOKEN }} |