-
Notifications
You must be signed in to change notification settings - Fork 36
59 lines (59 loc) · 2.25 KB
/
get-cloud-api-spec.yml
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
---
name: Fetch and Save Cloud API Spec
on:
workflow_dispatch: # Allows manual trigger of the workflow
repository_dispatch: # Allows other repositories to trigger this workflow
types: [trigger-cloud-api-docs]
jobs:
fetch-and-save-cloud-api-spec:
runs-on: ubuntu-latest
steps:
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_SM_READONLY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SM_READONLY_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: get secrets from aws sm
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
,sdlc/prod/github/actions_bot_token
parse-json-secrets: true
- name: Check out repository (main branch)
uses: actions/checkout@v4
with:
ref: 'main'
path: redpanda-docs
token: ${{ env.ACTIONS_BOT_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: |
cd ./redpanda-docs/scripts/get-api-specs
npm install
- name: Run the script and save the output
run: node ./redpanda-docs/scripts/get-api-specs/get-cloud-api-spec.js > ./redpanda-docs/cloud-api.yaml
env:
VBOT_GITHUB_API_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
- name: Checkout the repository
uses: actions/checkout@v4
with:
ref: api
token: ${{ env.ACTIONS_BOT_TOKEN }}
path: redpanda-docs-api
# Copy the generated file to the api branch
- name: Move generated file to API branch
run: mv ./redpanda-docs/cloud-api.yaml ./redpanda-docs-api/modules/ROOT/attachments/cloud-api.yaml
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "auto-docs: Update Cloud API spec"
token: ${{ env.ACTIONS_BOT_TOKEN }}
branch: update-branch-api
title: "auto-docs: Update Cloud API spec"
body: "This PR updates the OpenAPI spec file for the Cloud API."
labels: auto-docs
reviewers: JakeSCahill, kbatuigas