Skip to content

CLI Docs Update

CLI Docs Update #17

name: 'CLI Docs Update'
on:
workflow_dispatch:
inputs:
cli_release_tag:
description: 'Release tag from the CLI repo to update docs from'
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
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
ref: main
- name: Checkout CLI repo
uses: actions/checkout@v4
with:
path: cli
ref: ${{ github.event.inputs.cli_release_tag }}
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
working-directory: cli/temporalcli/internal/cmd/gen-docs
run: |
go run .
- name: Publish generated docs to documentation repo
env:
GH_TOKEN: ${{ github.token }}
working-directory: docs
run: |
set -ex
git config user.name "${{ github.event.inputs.commit_author }}"
git config user.email "${{ github.event.inputs.commit_author_email }}"
branch_name="update-cli-docs-${{ github.event.inputs.cli_release_tag }}"
git checkout -b $branch_name
cp ../cli/temporalcli/docs/*.mdx docs/cli/
git add .
git commit -m "${{ github.event.inputs.commit_message }}"
git push origin "$branch_name"
gh pr create \
--body "Autogenerated PR from https://github.com/temporalio/cli" \
--title "${{ github.event.inputs.commit_message }}" \
--head "$branch_name" \
--base "main"