-
Notifications
You must be signed in to change notification settings - Fork 133
57 lines (47 loc) · 1.59 KB
/
portman.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
name: Convert to Postman
on:
pull_request:
branches:
- master
jobs:
convert-to-postman:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Get changed files
id: get-changed-files
uses: tj-actions/changed-files@v36
with:
separator: ','
files: |
**.json
- name: Process changed JSON files
run: |
FILES="${{ steps.get-changed-files.outputs.all_changed_files }}"
IFS=","
for file in $FILES; do
echo "Processing $file"
npx @apideck/portman -l "$file" -o "./PostmanCollections/$file"
done
- name: Configure Git
if: ${{ steps.get-changed-files.outputs.any_changed == 'true' }}
run: |
git config --local user.email "${{ github.event.pull_request.user.email }}"
git config --local user.name "${{ github.event.pull_request.user.login }}"
- name: Commit changes
if: ${{ steps.get-changed-files.outputs.any_changed == 'true' }}
run: |
git add PostmanCollections/*
git commit -m "Update generated files by portman"
git pull --rebase origin "${{ github.head_ref }}"
- name: Push changes
if: ${{ steps.get-changed-files.outputs.any_changed == 'true' }}
uses: ad-m/[email protected]
with:
branch: ${{ github.head_ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}