Skip to content

Update OpenAPI specs (F5DC7185-BC8C-4833-951B-50B0EF81C706) #3

Update OpenAPI specs (F5DC7185-BC8C-4833-951B-50B0EF81C706)

Update OpenAPI specs (F5DC7185-BC8C-4833-951B-50B0EF81C706) #3

name: Update OpenAPI
on:
workflow_dispatch:
inputs:
uuid:
type: string
description: uuid to tag and track Github Actions run
default: ""
run-name: Update OpenAPI specs (${{ inputs.uuid}})
jobs:
update-open-api:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: install Redocly
run: npm i -g @redocly/cli@latest
- name: run Redocly
env:
GH_TOKEN: ${{ github.token }}
run: |
USER=$(gh api user -q .login)
TOKEN=$(gh auth token)
echo "https://${USER}:${TOKEN}@github.com" > ~/.git-credentials
./modules/ROOT/generate-docs.sh
- name: diff and raise PR
env:
GH_TOKEN: ${{ secrets.ACTION_TOKEN }}
USER: ${{ github.actor }}
run: |
BRANCH=$(git branch --show-current)
DATE=$(date "+%Y-%m-%d-%H.%M.%S")
git diff
git status
if [[ -n $(git status -s -uno) ]]; then
git checkout -b $BRANCH-$DATE
git config --global user.email "tech-comm-team@couchbase.com"
git config --global user.name "Tech Comm Team Couchbase"
git commit -a -m "Updated Operational API"
git push --set-upstream origin $BRANCH-$DATE
echo $USER
gh pr create --base "$BRANCH" --fill --reviewer "$USER" \
> $GITHUB_STEP_SUMMARY
cat $GITHUB_STEP_SUMMARY
fi