-
Notifications
You must be signed in to change notification settings - Fork 4
48 lines (44 loc) · 1.33 KB
/
selfserve-transform-specs.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
name: Transform Specs
on:
workflow_call:
inputs:
transformations:
description: 'Spec Transformer CLI Configurations'
type: string
required: true
repository:
description: 'Repository to checkout'
type: string
required: true
ref:
description: 'Branch or tag to checkout'
type: string
required: true
jobs:
transform-specs:
runs-on: ubuntu-latest
steps:
- name: Checkout product repository
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
path: product-repo
- name: Merge specs
working-directory: product-repo
run: |
if [ -d "./specs" ]; then
cd specs
cat <<< $(jq '.output = "./specs.yaml"' openapi-merge.json) > openapi-merge.json
npx openapi-merge-cli
mv specs.yaml ../
fi
- name: Transform specs
working-directory: product-repo
run: |
npx --yes -p @expediagroup/spec-transformer cli ${{ inputs.transformations }} -i specs.yaml -o transformedSpecs.yaml
- name: Upload transformed specs
uses: actions/upload-artifact@v4
with:
name: transformedSpecs
path: product-repo/transformedSpecs.yaml