EDU-10330 Updating Checkout API #845
Workflow file for this run
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: 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 }} |