Skip to content

chore: More tinkering part four #27

chore: More tinkering part four

chore: More tinkering part four #27

Workflow file for this run

name: 📄 Schemas
on:
push:
branches: [main, "**"]
# pull_request:
# branches: ["**"]
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/**'
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 }}
ref: ${{ github.event.pull_request.head.sha }}
- 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 changed files
# id: changed-files
# uses: tj-actions/changed-files@v42
# with:
# # files: homestar-runtime/schemas/docs/**
# files: |
# **.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: Check for modified files
id: git-check
shell: bash
run: |
# echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
echo modified=$(if [[ ($git diff) ]]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT
echo diff=$(git diff) >> $GITHUB_OUTPUT
- name: Show check modified value
env:
CHANGED: ${{ steps.git-check.outputs.modified }}
DIFF: ${{ steps.git-check.outputs.diff }}
run: |
echo "$CHANGED"
echo "$DIFF"
- name: Push changes
# if: steps.changed-files.outputs.any_changed == 'true'
if: steps.git-check.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