-
Notifications
You must be signed in to change notification settings - Fork 23
79 lines (71 loc) · 3.62 KB
/
oasdiff.yml
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
70
71
72
73
74
75
76
77
78
79
---
name: "OAS Breaking Changes"
defaults:
run:
shell: bash
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
revision_tag:
required: true
type: string
description: "Revision tag to check the breaking changes in the OAS"
base_tag:
required: false
type: string
description: "Base tag to check the breaking changes in the OAS"
default: "main"
permissions:
pull-requests: write
actions: write
# https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/prism-agent-v1.29.0/prism-agent/service/api/http/prism-agent-openapi-spec.yaml
# https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/main/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml
jobs:
oasdiff-breaking:
name: "Open API specification breaking changes detection"
runs-on: ubuntu-latest
steps:
- name: Resolve the base OpenAPI spec URL
env:
BASE_TAG: ${{ github.event.inputs.base_tag }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
run: |
echo Base tag: "$BASE_TAG"
if [[ "$BASE_TAG" =~ cloud-agent-v* ]]; then
echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${BASE_TAG}/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
elif [[ "$BASE_TAG" =~ prism-agent-v* ]]; then
echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${BASE_TAG}/prism-agent/service/api/http/prism-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
elif [[ "$BASE_TAG" == 'main' ]]; then
echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${BASE_TAG}/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
elif [[ "$GITHUB_EVENT_NAME" == 'pull_request' ]]; then
echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/main/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
fi
- name: Resolve the revision OpenAPI spec URL
env:
REV_TAG: ${{ github.event.inputs.revision_tag }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
echo Revision tag: "$REV_TAG"
if [[ "$REV_TAG" =~ cloud-agent-v* ]]; then
echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${REV_TAG}/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
elif [[ "$REV_TAG" =~ prism-agent-v* ]]; then
echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${REV_TAG}/prism-agent/service/api/http/prism-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
elif [[ "$REV_TAG" == 'main' ]]; then
echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${REV_TAG}/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
elif [[ "$GITHUB_EVENT_NAME" == 'pull_request' ]]; then
echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/${BRANCH_NAME}/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> "$GITHUB_ENV"
fi
- name: Check URLS
run: |
echo "Base url: ${{ env.BASE_URL }}"
echo "Revision url: ${{ env.REV_URL }}"
- name: Running OpenAPI Spec diff action
uses: oasdiff/oasdiff-action/breaking@main
with:
fail-on-diff: false
base: ${{ env.BASE_URL }}
revision: ${{ env.REV_URL }}