update-cli-docs #67
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 | |
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: | |
VCLUSTER_RELEASE_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-$VCLUSTER_RELEASE_VERSION" | |
git add ./vcluster/cli | |
# if there are no changes, exit early | |
if git diff-index --quiet HEAD --; then | |
exit 0 | |
fi | |
git commit -m "CLI DOC Update for vCluster release $VCLUSTER_RELEASE_VERSION" | |
git push origin "CLI-DOC-$VERSION" | |
gh pr create --base main -t "CLI DOC Update for vCluster release $VCLUSTER_RELEASE_VERSION" --body "Autogenerated PR for CLI docs" | |