Skip to content

Autodocs

Autodocs #12

Workflow file for this run

name: Autodocs
on:
workflow_dispatch:
inputs:
version:
description: "Version (e.g. 2.4.x)"
required: true
source_branch:
description: "Source Branch in kong/kong (e.g. release/2.4.x)"
required: true
target_branch:
description: "Target Branch in kong/docs.konghq.com (e.g. release/2.4)"
required: true
env:
BUILD_ROOT: ${{ github.workspace }}/bazel-bin/build
jobs:
build:
uses: ./.github/workflows/build.yml
with:
relative-build-root: bazel-bin/build
autodoc:
runs-on: ubuntu-22.04
needs: [build]
steps:
- name: Checkout Kong source code
uses: actions/checkout@v4
with:
path: kong
ref: ${{ github.event.inputs.source_branch }}
- name: Checkout Kong Docs
uses: actions/checkout@v4
with:
repository: kong/docs.konghq.com
path: docs.konghq.com
token: ${{ secrets.PAT }}
ref: ${{ github.event.inputs.target_branch }}
- name: Lookup build cache
uses: actions/cache@v4
id: cache-deps
with:
path: ${{ env.BUILD_ROOT }}
key: ${{ needs.build.outputs.cache-key }}
- name: Run Autodocs
run: |
cd kong
source ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
scripts/autodoc ../docs.konghq.com ${{ github.event.inputs.version }}
- name: Generate branch name
id: kong-branch
run: |
cd kong
output="$(git branch --show-current)"
echo "name=$output" >> $GITHUB_OUTPUT
- name: Show Docs status
run: |
cd docs.konghq.com
git status
git checkout -b "autodocs-${{ steps.kong-branch.outputs.name }}"
- name: Commit autodoc changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: "./docs.konghq.com"
commit_message: "Autodocs update"
branch: "autodocs-${{ steps.kong-branch.outputs.name }}"
skip_fetch: true
push_options: "--force"
- name: Raise PR
run: |
cd docs.konghq.com
echo "${{ secrets.PAT }}" | gh auth login --with-token
gh pr create --base "${{ github.event.inputs.target_branch }}" --fill --label "review:autodoc"