Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow to build CLI docs update PR when a vCluster PR has been merged #226

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/cli-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: cli-docs

on:
repository_dispatch:
types: [ update-cli-docs ]

env:
GITHUB_TOKEN: ${{ github.token }}

jobs:
update-cli-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout vcluster repository
uses: actions/checkout@v4
with:
repository: loft-sh/vcluster
fetch-depth: 0
ref: ${{ github.event.client_payload.ref }}
path: vcluster-repo
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Setup Just
uses: extractions/setup-just@v2
- name: Generate cli docs
working-directory: vcluster-repo
run: just generate-cli-docs
- uses: actions/checkout@v4
with:
repository: loft-sh/vcluster-docs
fetch-depth: 0
path: vcluster-docs
- name: Copy generated files
env:
PR_TITLE: ${{ github.event.client_payload.title }}
PR_REF: ${{ github.event.client_payload.ref }}
PR_VERSION: ${{ github.event.client_payload.version }}
run: |
# set git info
git config --global user.name "Loft Bot"
git config --global user.email '[email protected]'

cp -r ./vcluster-repo/docs/pages/cli vcluster-docs/vcluster

cd vcluster-docs
git checkout -b "CLI-DOC-$PR_REF"
git add ./vcluster/cli

# if there are no changes, exit early
if git diff-index --quiet HEAD --; then
exit 0
fi

git commit -m "DOC Update from $PR_TITLE"

git push origin "CLI-DOC-$PR_REF"
gh pr create --base main -t "DOC Update from $PR_TITLE" --body "Autogenerated PR for CLI docs"

5 changes: 5 additions & 0 deletions vcluster/cli/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "CLI",
"position": "4"
}

Loading