Merge pull request #459 from freee/feature/update_schema_files_2024-0… #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-postman-collection | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: cache node_modules | |
id: node_modules_cache_id | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-nodemodule | |
- name: set up tool | |
if: steps.node_modules_cache_id.outputs.cache-hit != 'true' | |
run: npm install [email protected] && npm install [email protected] | |
update-accounting-postman-collection: | |
runs-on: ubuntu-latest | |
needs: setup | |
env: | |
product: accounting | |
download-url: https://raw.githubusercontent.com/freee/freee-api-schema/master/v2020_06_15/open-api-3/api-schema.json | |
collection-id: 77985c23-b135-4b1b-898f-7f4890e2bb0b | |
postman-api-key: ${{ secrets.POSTMAN_API_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore node_modules | |
id: node_modules_cache_id | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-nodemodule | |
- name: download schema | |
run: curl -o tmp/${{ env.product }}/oas.json --create-dirs ${{ env.download-url }} | |
- name: remove urlencoded | |
run: bash ./script/remove_urlencoded.sh | |
- name: generate collection | |
run: node_modules/.bin/openapi2postmanv2 -s tmp/${{ env.product }}/oas.json -o tmp/${{ env.product }}/collection.json -p -O folderStrategy=Tags,parametersResolution=Example,stackLimit=50,enableOptionalParameters=false | |
- name: update collection | |
run: node script/update-postman-collection.js ${{ env.product }} ${{ env.collection-id }} ${{ env.postman-api-key }} | |
update-hr-postman-collection: | |
runs-on: ubuntu-latest | |
needs: setup | |
env: | |
product: hr | |
download-url: https://raw.githubusercontent.com/freee/freee-api-schema/master/hr/open-api-3/api-schema.json | |
collection-id: 7ba7d5ed-5cdd-4946-8922-cbee12187829 | |
postman-api-key: ${{ secrets.POSTMAN_API_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore node_modules | |
id: node_modules_cache_id | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-nodemodule | |
- name: download schema | |
run: curl -o tmp/${{ env.product }}/oas.json --create-dirs ${{ env.download-url }} | |
- name: generate collection | |
run: node_modules/.bin/openapi2postmanv2 -s tmp/${{ env.product }}/oas.json -o tmp/${{ env.product }}/collection.json -p -O folderStrategy=Tags,parametersResolution=Example,stackLimit=50,enableOptionalParameters=false | |
- name: update collection | |
run: node script/update-postman-collection.js ${{ env.product }} ${{ env.collection-id }} ${{ env.postman-api-key }} |