Repository navigation
71 lines (62 loc) · 2.53 KB
/
Copy pathdocs-reference.yaml
File metadata and controls
71 lines (62 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: docs-reference
# Keeps the docs site's command reference in step with the CLI: on every
# release tag it regenerates the MDX pages (`make docs`) in a checkout of
# the docs repository and opens a pull request there when they changed.
#
# Configure in the repository settings:
# - vars.DOCS_REPO: the docs repository, owner/name
# - secrets.DOCS_REPO_TOKEN: a token that can push branches and open
# pull requests there
# Without them the job skips with a notice.
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: read
jobs:
reference:
runs-on: ubuntu-latest
env:
DOCS_REPO: ${{ vars.DOCS_REPO }}
HAS_TOKEN: ${{ secrets.DOCS_REPO_TOKEN != '' }}
steps:
- name: Check the configuration
id: config
run: |
if [ -n "$DOCS_REPO" ] && [ "$HAS_TOKEN" = "true" ]; then
echo "ready=true" >> "$GITHUB_OUTPUT"
else
echo "ready=false" >> "$GITHUB_OUTPUT"
echo "::notice::DOCS_REPO or DOCS_REPO_TOKEN is not configured; skipping the reference update."
fi
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
if: steps.config.outputs.ready == 'true'
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
if: steps.config.outputs.ready == 'true'
with:
repository: ${{ vars.DOCS_REPO }}
token: ${{ secrets.DOCS_REPO_TOKEN }}
path: .docs
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
if: steps.config.outputs.ready == 'true'
with:
go-version-file: go.mod
- name: Regenerate the command reference
if: steps.config.outputs.ready == 'true'
run: make docs DOCS=.docs
- name: Open a pull request on the docs repository
if: steps.config.outputs.ready == 'true'
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11
with:
path: .docs
token: ${{ secrets.DOCS_REPO_TOKEN }}
branch: chore/cli-reference-${{ github.ref_name }}
commit-message: "docs(cli): command reference for ${{ github.ref_name }}"
title: "docs(cli): command reference for ${{ github.ref_name }}"
body: |
Regenerated from the CLI's help text at ${{ github.ref_name }}
(`make docs` in the CLI repository). Review the hand-written
guides for anything the new release changed.
add-paths: content/docs/platform/cli-reference/**