Skip to content

Commit 2cae369

Browse files
committed
Add cloud spec automation
1 parent 3d9d3b1 commit 2cae369

File tree

4 files changed

+6382
-0
lines changed

4 files changed

+6382
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Fetch and Save Cloud API Spec
2+
3+
on:
4+
workflow_dispatch: # Allows manual trigger of the workflow
5+
repository_dispatch: # Allows other repositories to trigger this workflow
6+
types: [trigger-cloud-api-docs]
7+
8+
jobs:
9+
fetch-and-save-cloud-api-spec:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
13+
contents: read
14+
steps:
15+
- uses: aws-actions/configure-aws-credentials@v4
16+
with:
17+
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
18+
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
19+
- uses: aws-actions/aws-secretsmanager-get-secrets@v2
20+
with:
21+
secret-ids: |
22+
,sdlc/prod/github/actions_bot_token
23+
parse-json-secrets: true
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '18'
29+
30+
- name: Check out repository
31+
uses: actions/checkout@v4
32+
with:
33+
ref: 'main'
34+
path: redpanda-docs
35+
token: ${{ env.ACTIONS_BOT_TOKEN }}
36+
37+
- name: Get commit SHA and build URL
38+
id: commit-info
39+
run: |
40+
COMMIT_SHA="${{ github.event.client_payload.commit_sha }}"
41+
COMMIT_URL="https://github.com/redpanda-data/cloudv2/commit/${COMMIT_SHA}"
42+
echo "COMMIT_SHA=${COMMIT_SHA}" >> $GITHUB_ENV
43+
echo "COMMIT_URL=${COMMIT_URL}" >> $GITHUB_ENV
44+
45+
- name: Install dependencies
46+
run: |
47+
npm install
48+
49+
- name: Run the script and save the output
50+
run: |
51+
npx doc-tools fetch -o redpanda-data -r cloudv2 -p proto/gen/openapi/openapi.controlplane.prod.yaml -d ../../modules/ROOT/attachments cloud-controlplane-api.yaml
52+
npx doc-tools fetch -o redpanda-data -r cloudv2 -p proto/gen/openapi/openapi.dataplane.prod.yaml -d ../../modules/ROOT/attachments cloud-dataplane-api.yaml
53+
env:
54+
VBOT_GITHUB_API_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
55+
- name: Create pull request
56+
uses: peter-evans/create-pull-request@v6
57+
with:
58+
commit-message: "auto-docs: Update Cloud API spec"
59+
token: ${{ env.ACTIONS_BOT_TOKEN }}
60+
path: redpanda-docs
61+
branch: update-branch-api
62+
title: "auto-docs: Update Cloud API spec"
63+
body: |
64+
This PR updates the OpenAPI spec file for the Cloud API.
65+
Triggered by commit: [${{ env.COMMIT_SHA }}](${{ env.COMMIT_URL }})
66+
labels: auto-docs
67+
reviewers: JakeSCahill, kbatuigas

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

0 commit comments

Comments
 (0)