Skip to content

auto_generate_api_client #82

auto_generate_api_client

auto_generate_api_client #82

name: auto_generate_api_client
on:
repository_dispatch:
types: [auto_generate_api_client]
jobs:
AutoGenerateAPIClient:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# needed by "gh pr create"
fetch-depth: 0
- name: Generate API Client
run: |
bash autogenerate_api_client.sh https://raw.githubusercontent.com/TaskarCenterAtUW/TDEI-ExternalAPIs/dev/tdei-api-gateway.json
- name: Run Bash Script
run: |
if which git >/dev/null 2>&1; then
if git rev-parse --verify feature-generate-api-client >/dev/null 2>&1; then
git branch -D feature-generate-api-client
fi
git config --global user.email "workflow_dummy@gaussian.com"
git config --global user.name "workflow item"
git checkout -b feature-generate-api-client
git add .
git commit -m "system:auto generated API client"
git push -fu origin feature-generate-api-client
else
echo "Git is not installed."
exit 1
fi
gh pr create --base main --fill
gh pr merge feature-generate-api-client --merge --delete-branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run API Tester Workflow
run: |
curl -X POST https://api.github.com/repos/TaskarCenterAtUW/TDEI-api-tester/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACTIONS_KEY }} \
--data '{"event_type": "run_api_tests"}'