feat: Add OpenRPC API docs and associated JSON Schemas #5
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: 📄 Schemas | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ["**"] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
schemas: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.HOMESTAR_UPDATE_TOKEN }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run generate schemas | |
run: cargo run --bin schemas | |
- name: Check for changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v42 | |
with: | |
files: homestar-runtime/schemas/docs/*.json | |
since_last_remote_commit: true | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
- name: Push changes | |
if: steps.changed-files.outputs.any_changed == 'true' | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
git commit -am "chore(schemas): update OpenRPC API doc and JSON schemas" | |
git push --force-with-lease origin HEAD:refs/heads/${{ github.head_ref }} |