Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: apiclient dispatch #44

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 🔀OpenAPI - Axios Client

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout ⬇️
uses: actions/checkout@v4.2.2
with:
show-progress: false

- name: Cache Dependencies 📦
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Copy Config File 📄
run: cp config.yaml.example config.yaml

- name: Build 🛠️
run: cargo build --verbose

- name: Generate OpenAPI Spec 📜
run: cargo run -- merge --url 'http://0.0.0.0:8080' --specs './docs/' --output './static/openapi.html'

- name: Check if the schema was modified 🧐
id: diff
run: |
diff=$(git status -su | grep static/openapi.yaml | wc -l)
echo "diff=$diff" >> $GITHUB_ENV

- name: Commit changes 📤
if: ${{ env.diff != '0' && github.event_name == 'push' }}
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git add .
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update openapi schema 🔄" && git push)

- name: Dispatch event to Axios Client 🚀
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: fis2425
repo: apiclient
github_token: ${{ secrets.DISPATCH_TOKEN }}
workflow_file_name: generation.yml
ref: main
wait_workflow: false
Loading