Skip to content

chore(schemas): update OpenRPC API doc and JSON schemas #65

chore(schemas): update OpenRPC API doc and JSON schemas

chore(schemas): update OpenRPC API doc and JSON schemas #65

Workflow file for this run

name: 📄 Schemas
on:
push:
branches: [main, "bgins/run-schemas-*"]
# branches: [main, "release-plz-*"]
# branches: [main, "**"]
permissions:
contents: write
pull-requests: write
jobs:
changes:
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- 'homestar-invocation/src/**'
- 'homestar-runtime/src/**'
- 'homestar-schemas/src/**'
- 'homestar-workflow/src/**'
- 'Cargo.toml'
schemas:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.HOMESTAR_UPDATE_TOKEN }}
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Project
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: test-all-stable-ubuntu-latest
save-if: ${{ github.event_name == 'push' }}
- name: Sccache
uses: mozilla-actions/[email protected]
- name: Run generate schemas
run: cargo run -p homestar-schemas
- name: Check for modified schemas
id: git-check-schemas
shell: bash
run: echo modified=$(if [[ $(git diff homestar-runtime/schemas/) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT
- name: Check for updated version
id: git-check-manifest
shell: bash
run: echo modified=$(if [[ $(git diff Cargo.toml) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT
- name: Echo results
run: |
echo Manifest version updated:
echo ${{ steps.git-check-manifest.outputs.modified }}
echo Schemas updated:
echo ${{ steps.git-check-schemas.outputs.modified }}
echo Branch starts with bgins/run-schemas:
echo ${{ startsWith(github.ref_name, 'bgins/run-schemas') }}
echo Check main condition:
echo ${{ (github.ref_name == 'main' && (steps.git-check-schemas.outputs.modified == 'true' || steps.git-check-manifest.outputs.modified == 'true')) }}
echo Check branch condition:
echo ${{ (startsWith(github.ref_name, 'bgins/run-schemas') && steps.git-check-manifest.outputs.modified == 'true') }}
- name: Push changes
# if: ${{ steps.git-check-schemas.outputs.modified == 'true' || steps.git-check-manifest.outputs.modified == 'true' }}
# (github.ref_name == 'bgins/run-schemas-*' && steps.git-check-manifest.outputs.modified == 'true')
if: |
${{ (github.ref_name == 'main' && (steps.git-check-schemas.outputs.modified == 'true' || steps.git-check-manifest.outputs.modified == 'true')) ||
(startsWith(github.ref_name, 'bgins/run-schemas') && steps.git-check-manifest.outputs.modified == '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