Skip to content

feat: define common interfaces in a versioned schema (#202) #86

feat: define common interfaces in a versioned schema (#202)

feat: define common interfaces in a versioned schema (#202) #86

Workflow file for this run

name: Bundle & Push JSON schema
on:
push:
branches:
- main
paths:
- 'schemas/**'
jobs:
setup:
runs-on: ubuntu-latest
name: Set up a branch to update schemas
outputs:
branch_name: ${{ steps.branch-name.outputs.branch_name }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Create new branch
id: branch-name
shell: bash
run: |
git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
BRANCH_NAME="ci/update-schemas-$(date +%s)"
echo "Generated branch name: $BRANCH_NAME"
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
git checkout -b ${BRANCH_NAME}
git push -u origin ${BRANCH_NAME}
bundle-schemas:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
include:
- schema: application
schema-path: ./schemas/applications/schema
- schema: component
schema-path: ./schemas/component-descriptions/schema
- schema: controller
schema-path: ./schemas/controller-descriptions/schema
- schema: interfaces
schema-path: ./schemas/interfaces/schema
name: Bundle the ${{ matrix.schema }} schema
steps:
- uses: ./.github/actions/bundle-schema
with:
schema-path: ${{ matrix.schema-path }}/${{ matrix.schema }}.schema.json
schema: ${{ matrix.schema }}.schema.json
branch-name: ${{ needs.setup.outputs.branch_name }}
push-schemas:
runs-on: ubuntu-latest
needs: [setup, bundle-schemas]
steps:
- name: Checkout branch ${{ needs.setup.outputs.branch_name }}
uses: actions/checkout@v3
with:
ref: ${{ needs.setup.outputs.branch_name }}
- name: Create pull request on branch ${{ needs.setup.outputs.branch_name }}
shell: bash
run: |
MESSAGE=$(
gh pr create \
-B main \
-H ${{ needs.setup.outputs.branch_name }} \
--title 'ci: update schemas' \
--body 'This PR was automatically created by GitHub actions in response to schema changes. Please review and update any impacted code before merging the changes.' \
--reviewer domire8 \
--reviewer eeberhard \
2>&1
) || echo "::warning::Error creating the PR: $MESSAGE"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}