-
Notifications
You must be signed in to change notification settings - Fork 38
59 lines (45 loc) · 1.49 KB
/
update-open-api.yml
File metadata and controls
59 lines (45 loc) · 1.49 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
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