Skip to content

Feat: Add metadata validation workflow and scripts #53

Feat: Add metadata validation workflow and scripts

Feat: Add metadata validation workflow and scripts #53

name: validate-metadata-schema
env:
PYTHON_VERSION: 3.11
COMPONENT_VALIDATION_PATH: $GITHUB_WORKSPACE/.github/resources/scripts/get_components_for_validation.sh
on:
pull_request:
paths:
- 'component/pipelines/**'
- 'scripts/**'
jobs:
validate-component-metadata-schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Test dependencies
run: |
pip install -r scripts/validate_metadata/requirements.txt
- name: Retrieve new components
id: get-new-components
run: ${{ env.COMPONENT_VALIDATION_PATH }} "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" validate_metadata
- name: Validate new components
if: ${{ steps.get-new-components.outputs.new_components_list != '' }}
run: |
SCRIPT_PATH="$GITHUB_WORKSPACE/scripts/validate_metadata/validate_metadata.py"
NEW_COMPONENTS_ARRAY="${{ steps.get-new-components.outputs.new_components_list }}"
# 2. Set IFS to a comma, so that the shell will split the string by commas.
IFS=','
for component in $NEW_COMPONENTS_ARRAY; do
COMPONENT_PATH="$GITHUB_WORKSPACE/$component"
echo "Processing component: $component"
python $SCRIPT_PATH --component $COMPONENT_PATH
done