Skip to content

trigger-cloud-api-docs #100

trigger-cloud-api-docs

trigger-cloud-api-docs #100

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
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
,sdlc/prod/github/actions_bot_token
parse-json-secrets: true
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Check out repository
uses: actions/checkout@v4
with:
ref: 'api'
path: redpanda-docs
token: ${{ env.ACTIONS_BOT_TOKEN }}
- name: Get commit SHA and build URL
id: commit-info
run: |
COMMIT_SHA="${{ github.event.client_payload.commit_sha }}"
COMMIT_URL="https://github.com/redpanda-data/cloudv2/commit/${COMMIT_SHA}"
echo "COMMIT_SHA=${COMMIT_SHA}" >> $GITHUB_ENV
echo "COMMIT_URL=${COMMIT_URL}" >> $GITHUB_ENV
- name: Install dependencies
run: |
cd ./redpanda-docs/scripts/fetch-from-github
npm install
- name: Run the script and save the output
run: |
cd ./redpanda-docs/scripts/fetch-from-github
node fetch.js redpanda-data cloudv2 proto/gen/openapi/openapi.prod.yaml ../../modules/ROOT/attachments cloud-api.yaml
env:
VBOT_GITHUB_API_TOKEN: ${{ env.ACTIONS_BOT_TOKEN }}
- 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 }}
path: redpanda-docs
branch: update-branch-api
title: "auto-docs: Update Cloud API spec"
body: |
This PR updates the OpenAPI spec file for the Cloud API.
Triggered by commit: [${{ env.COMMIT_SHA }}](${{ env.COMMIT_URL }})
labels: auto-docs
reviewers: JakeSCahill, kbatuigas