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

generating P.sh CLI command doc page #3733

Merged
merged 34 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6365d4b
first try for generating P.sh CLI command doc page
flovntp Feb 7, 2024
a5f1dc7
adding generation to opened PR
flovntp Feb 7, 2024
cff2674
FHK : test workflow
flovntp Feb 8, 2024
fb57cc0
remove condition
flovntp Feb 8, 2024
a1f7cb3
testing envVar
flovntp Feb 8, 2024
e71afda
test PLATFORMSH_CLI_TOKE?
flovntp Feb 8, 2024
658a060
removing name of the branch
flovntp Feb 8, 2024
c2999d2
missing checkout before push
flovntp Feb 8, 2024
39d8782
debug
flovntp Feb 8, 2024
0fd5ec4
debug
flovntp Feb 8, 2024
6905f43
debug
flovntp Feb 8, 2024
6666f84
debug
flovntp Feb 8, 2024
c5c3fd2
debug
flovntp Feb 8, 2024
340eb8d
debug
flovntp Feb 8, 2024
953e57e
debug
flovntp Feb 8, 2024
7282fb1
debug
flovntp Feb 8, 2024
cca99b6
debug
flovntp Feb 8, 2024
432a433
testing another push option
flovntp Feb 8, 2024
efbd2c5
adding push force
flovntp Feb 8, 2024
dbe90e8
avoid infinite loop
flovntp Feb 8, 2024
957ab91
last try
flovntp Feb 8, 2024
0ac52b0
Merge branch 'main' into fix-cli-commands
chadwcarlson Feb 8, 2024
0e84797
CLI command page suggestions.
chadwcarlson Feb 8, 2024
8cbc0f1
Merge pull request #3740 from platformsh/commands-suggest
flovntp Feb 9, 2024
82afd58
resolve conflicts
flovntp Feb 9, 2024
cf5e3ce
working version, on demand, of the workflow
flovntp Feb 9, 2024
adc3c0f
Merge branch 'main' into fix-cli-commands
flovntp Feb 9, 2024
16c0e30
revert on region-migration.md
flovntp Feb 9, 2024
17e1507
Update .github/workflows/generate-cli-commands-page.yaml
flovntp Feb 9, 2024
03f441d
optimize script to generate doc page
flovntp Feb 9, 2024
b3043cf
Allow for Upsun CLI page.
chadwcarlson Feb 9, 2024
dc0502f
Merge pull request #3743 from platformsh/upsun-cli
flovntp Feb 9, 2024
67ff21e
just change CLI version to 5.0.8 to be able to generate a new pull re…
flovntp Feb 9, 2024
c383310
Merge branch 'main' into fix-cli-commands
chadwcarlson Feb 9, 2024
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
9 changes: 9 additions & 0 deletions .github/actions/set-up-upsun-cli/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Set up Upsun CLI
description: Installs the Upsun CLI.

runs:
using: "composite"
steps:
- name: Install Upsun CLI
run: curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | VENDOR=upsun bash
shell: bash
77 changes: 77 additions & 0 deletions .github/workflows/generate-cli-commands-page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Generate CLI commands doc page

on:
workflow_dispatch:
branches: [ main, test-workflow ]
# pull_request:
# branches: [main]
# types: [labeled,opened,unlabeled,synchronize]
# schedule:
# # Run at 00:15 every day
# - cron: '15 */19 * * *'

env:
PLATFORMSH_CLI_NO_INTERACTION: 1
PLATFORM_PROJECT: ${{ vars.PROJECT_ID }}
PLATFORMSH_CLI_DEFAULT_TIMEOUT: 60 # Increase timeout for CLI commands
SLEEP_TIME: 5
NUM_TRIES: 30
BRANCH_TITLE: cli-commands-doc-page
DEFAULT_BRANCH: "main"
PLATFORMSH_CLI_DOC_PATH: "sites/platform/src/administration/cli/reference.md"
UPSUN_CLI_DOC_PATH: "sites/friday/src/administration/cli/reference.md"
permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.DEFAULT_BRANCH }}
token: ${{ secrets.WORKFLOW_TOKEN }}

# Set up workflow environment to use the Platform.sh CLI
- name: Set up Platform.sh CLI
uses: ./.github/actions/set-up-cli

# Set up workflow environment to use the Upsun CLI
- name: Set up Upsun CLI
uses: ./.github/actions/set-up-upsun-cli

- name: Make changes to pull request
run: |
# Generate Platform.sh CLI command doc pages

# Adding CLI Commands specific page
echo "Generating Platform.sh CLI doc page"
./shared/scripts/gen-cli-docs.sh ${{ env.PLATFORMSH_CLI_DOC_PATH }} platform
echo "Generating Upsun CLI doc page"
./shared/scripts/gen-cli-docs.sh ${{ env.UPSUN_CLI_DOC_PATH }} upsun

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.WORKFLOW_TOKEN }}
commit-message: Update CLI docs to latest version
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
signoff: false
add-paths: |
${{ env.PLATFORMSH_CLI_DOC_PATH }}
${{ env.UPSUN_CLI_DOC_PATH }}
branch: ${{ env.BRANCH_TITLE }}
delete-branch: false
title: '[CLI-BOT] Update on doc pages for CLI commands'
body: |
Some changes occurs on the CLI Commands doc page, that is automatically generated from:
- `platform list --format=md`
- `upsun list --format=md`
labels: |
report
automated pr
#assignees: flovntp
#reviewers: flovntp
draft: false
12 changes: 12 additions & 0 deletions shared/pages/commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "CLI Command reference"
sidebarTitle: "Command reference"
weight: 2
showTitle: false
---

<style>
#TableOfContents > ul > li > ul {
display: none;
}
</style>
15 changes: 15 additions & 0 deletions shared/scripts/gen-cli-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

cp shared/pages/commands.md $1

VERSION=$($2 version)
printf "\n# $VERSION\n" >> $1

printf "\n- [Installation](/administration/cli#1-install)" >> $1
printf "\n- [Open an issue](https://github.com/platformsh/cli/issues)\n" >> $1

printf "\n## All commands\n" >> $1

$2 list --format=md | tail -n +2 >> $1

git add $1
1 change: 1 addition & 0 deletions sites/friday/config/_default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module:
# - "administration/*"
- "administration/sso.md"
- "administration/pricing/*"
- "administration/cli/reference.md"

# - "changelog/*"

Expand Down
Loading
Loading