This repository was archived by the owner on Feb 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
114 lines (94 loc) · 4.74 KB
/
postman.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: sync-postman-collections
on:
push:
branches:
- main
jobs:
cancel_running_workflows:
name: Cancel running workflows
runs-on: ubuntu-22.04
steps:
- name: cancel running workflows
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5
with:
access_token: ${{ github.token }}
sync_core_collection:
name: Sync Postman Core collection w/ latest main
environment: Postman
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
pull-requests: read
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%b %d, %H:%M')" >> $GITHUB_OUTPUT
- name: Configure AWS credentials to fetch secrets
uses: aws-actions/configure-aws-credentials@97271860067ec931c45b8d104fbf0d15954ab85c
with:
role-to-assume: "arn:aws:iam::${{ secrets.SECRETS_ACCOUNT_ID }}:role/gh-radixdlt-secrets-read-access"
aws-region: "eu-west-2"
role-session-name: "radixdlt-sync-postman-${{ github.run_number }}-${{ github.run_attempt }}"
- name: Fetch AWS secrets
uses: aws-actions/aws-secretsmanager-get-secrets@287592d14d9c9c48199db83dc182ae12af3df18e
with:
secret-ids: |
GH, github-actions/radixdlt/radixdlt/postman-token
parse-json-secrets: true
- name: Setup Postman credentials
uses: DamianReeves/write-file-action@e19fd875ed54f16fc583a3486e62547ce4a5dde8
with:
path: .env
contents: POSTMAN_API_KEY=${{ env.GH_POSTMAN_API_TOKEN }}
write-mode: overwrite
- name: Checkout core repo
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
with:
repository: radixdlt/radixdlt
path: core
- name: Change OpenApi version in the Core API spec
run: sed -i 's/3.1.0/3.0.0/' core/radixdlt-core/radixdlt/src/main/java/com/radixdlt/api/core/api.yaml
- name: Create Portman configuration for Core API
uses: DamianReeves/write-file-action@e19fd875ed54f16fc583a3486e62547ce4a5dde8
with:
path: cliopts.json
contents: '{"postmanWorkspaceName":"Team Workspace"}'
write-mode: overwrite
- name: Replace hardcoded values with variables
run: |
sed -i 's/mainnet/"{{network}}"/g' core/radixdlt-core/radixdlt/src/main/java/com/radixdlt/api/core/api.yaml
- name: Update Postman's Core API collection from the spec
run: |
npx @apideck/portman -l core/radixdlt-core/radixdlt/src/main/java/com/radixdlt/api/core/api.yaml \
--postmanUid 14449947-f288f14a-5deb-4427-bde5-52c2f4c696de --syncPostman true --envFile .env
- name: Download the Core API collection
run: |
curl -X GET -H "X-API-KEY:${{env.GH_POSTMAN_API_TOKEN}}" https://api.getpostman.com/collections/14449947-f288f14a-5deb-4427-bde5-52c2f4c696de > tmp.core.collection.json
- name: Add a timestamp to the name
run: |
sed -i 's/"name":".*","description":"This API/"name":"Core API (main) ${{steps.date.outputs.date}} UTC","description":"This API/' tmp.core.collection.json
- name: Change the baseUrl variable name
run: |
sed -i 's/{{baseUrl}}/{{coreBaseUrl}}/g' tmp.core.collection.json
- name: Update the Core API collection
run: |
curl -X PUT -H "X-API-KEY:${{env.GH_POSTMAN_API_TOKEN}}" -H "Content-Type: application/json" \
https://api.getpostman.com/collections/14449947-f288f14a-5deb-4427-bde5-52c2f4c696de --data "@tmp.core.collection.json"
- name: Update Postman's System API collection from the spec
run: |
npx @apideck/portman -l core/radixdlt-core/radixdlt/src/main/java/com/radixdlt/api/system/api.yaml \
--postmanUid 14449947-573cde3b-1504-4ba0-a865-ada778e08c74 --syncPostman true --envFile .env
- name: Download the System API collection
run: |
curl -X GET -H "X-API-KEY:${{env.GH_POSTMAN_API_TOKEN}}" https://api.getpostman.com/collections/14449947-573cde3b-1504-4ba0-a865-ada778e08c74 > tmp.system.collection.json
- name: Add a timestamp to the name
run: |
sed -i 's/"name":".*","schema"/"name":"System API (main) ${{steps.date.outputs.date}} UTC","schema"/' tmp.system.collection.json
- name: Change the baseUrl variable name
run: |
sed -i 's/{{baseUrl}}/{{systemBaseUrl}}/g' tmp.system.collection.json
- name: Update the System API collection
run: |
curl -X PUT -H "X-API-KEY:${{env.GH_POSTMAN_API_TOKEN}}" -H "Content-Type: application/json" \
https://api.getpostman.com/collections/14449947-573cde3b-1504-4ba0-a865-ada778e08c74 --data "@tmp.system.collection.json"