CLI Docs Update #6
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: 'CLI Docs Update' | |
| on: | |
| push: | |
| branches: | |
| - "cli-docs-autoupdate" | |
| workflow_dispatch: | |
| inputs: | |
| cli_branch: | |
| description: 'Branch or tag from the CLI repo' | |
| required: true | |
| commit_author: | |
| description: 'Name to use for the commit author' | |
| required: true | |
| commit_author_email: | |
| description: 'Email to use for the commit author' | |
| required: true | |
| commit_message: | |
| description: 'Commit message for the docs update' | |
| required: true | |
| jobs: | |
| update: | |
| name: 'Pull changes from the CLI repo and update CLI docs' | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Generate token | |
| id: generate_token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }} | |
| private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| token: ${{ steps.generate_token.outputs.token }} | |
| path: docs | |
| - name: Checkout cli repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: cli | |
| ref: ${{ github.event.inputs.cli_branch }} | |
| submodules: recursive | |
| persist-credentials: true | |
| token: ${{ steps.generate_token.outputs.token }} | |
| repository: temporalio/cli | |
| - name: Setup Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.22' | |
| - name: Generate CLI docs | |
| run: | | |
| cd cli/temporalcli/internal/cmd/gen-docs | |
| go run . | |
| - name: Publish generated docs to documentation repo | |
| run: | | |
| set -ex | |
| cd docs | |
| git config user.name "${{ github.event.inputs.commit_author }}" | |
| git config user.email "${{ github.event.inputs.commit_author_email }}" | |
| git checkout -b ${{ github.event.inputs.cli_branch }} | |
| cp ../cli/temporalcli/docs/*.mdx docs/cli/ | |
| git add . | |
| git commit -m "${{ github.event.inputs.commit_message }}" | |
| git push origin "${{ github.event.inputs.cli_branch }}" | |
| gh pr create \ | |
| --body "Autogenerated PR from https://github.com/temporalio/cli" \ | |
| --title "${{ github.event.inputs.commit_message }}" \ | |
| --head "${{ github.event.inputs.cli_branch }}" \ | |
| --base "main" |