-
Notifications
You must be signed in to change notification settings - Fork 159
69 lines (61 loc) · 2.37 KB
/
update-oas-docs.yaml
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
60
61
62
63
64
65
66
67
68
69
## This is not in use at the moment. We use https://github.com/TykTechnologies/exp/blob/main/.github/workflows/tyk-docs.yml
###
# This workflow will update the OAS API Definition Object on tyk-docs
name: 'DEPRECATED: Tyk OAS API definition fields sync'
on:
workflow_dispatch:
inputs:
docBranch:
description: 'Docs Branch'
required: true
default: 'master'
gatewayBranch:
description: 'Gateway Branch'
required: true
default: 'master'
repository_dispatch:
types: [tyk-oas-docs]
env:
GOPRIVATE: github.com/TykTechnologies
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Set Repository Dispatch ENV
if: ${{ github.event_name == 'repository_dispatch'}}
run: |
echo "GW_BRANCH=${{ github.event.client_payload.sha }}" >> $GITHUB_ENV
echo "DOC_BRANCH=${{ github.event.client_payload.ref }}" >> $GITHUB_ENV
echo "TRIGGER=Automatically triggered: " >> $GITHUB_ENV
- name: Set Workflow Dispatch env
if: ${{ github.event_name == 'workflow_dispatch'}}
run: |
echo "GW_BRANCH=${{ github.event.inputs.gatewayBranch }}" >> $GITHUB_ENV
echo "DOC_BRANCH=${{ github.event.inputs.docBranch }}" >> $GITHUB_ENV
echo "TRIGGER=Manual triggered: " >> $GITHUB_ENV
- name: checkout tyk-docs/${{ env.DOC_BRANCH }}
uses: actions/checkout@v3
with:
token: ${{ secrets.ORG_GH_TOKEN }}
ref: ${{ env.DOC_BRANCH }}
path: ./tyk-docs
- name: checkout tyk/${{ env.GW_BRANCH }}
uses: actions/checkout@v3
with:
repository: TykTechnologies/tyk
token: ${{ secrets.ORG_GH_TOKEN }}
ref: ${{ env.GW_BRANCH }}
path: ./tyk
- name: Copy OAS Docs
run: |
cat ./tyk/apidef/oas/schema/x-tyk-gateway.md > ./tyk-docs/tyk-docs/content/shared/x-tyk-gateway.md
- name: Raise pull request
uses: peter-evans/create-pull-request@v4
with:
commit-message: import Tyk OAS API Definition Object from ${{ env.GW_BRANCH }}
title: ${{env.TRIGGER}} import OAS API DefinitionObject from ${{ env.GW_BRANCH }}
branch: oas-api-def/${{ env.DOC_BRANCH }}/update-doc
path: ./tyk-docs
branch-suffix: random
delete-branch: true
reviewers: letzya, Keithwachira, dcs3spp