Skip to content

Reconciled

Reconciled #18

# This is a basic workflow to help you get started with Actions
name: filter-changes
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ develop ]
# pull_request:
# branches: [ develop ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
filter_schema_modifications:
# The type of runner that the job will run on
runs-on: ubuntu-latest
outputs:
schema_change: ${{ steps.specification_modifications.outputs.SCHEMACHANGED }}
prop_quants_change: ${{ steps.specification_modifications.outputs.PROPSQUANTSCHANGED }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Modified files
- id: file_changes
uses: trilom/[email protected]
- name: Filter changed files
run: |
cat $HOME/files.json
echo '${{ steps.file_changes.outputs.files }}'
- name: Specification modifications
id: specification_modifications #grep -o .xml files.json | wc -w (for counting multiple instances per line)
run: |
if [[ $HOME/files.json ]] && [[ $(($(grep -o ".xml" $HOME/files.json | wc -l)-$(grep -oiE "DocProperty.xml|DocQuantity.xmlDoc|PropertySet.xml|DocQuantitySet.xml|DocTemplateDefinition.xml|DocTemplateItem.xml|DocTemplateUsage.xml|DocPropertyConstant.xml|DocPropertyEnumeration.xml|Documentation.md" $HOME/files.json | wc -l))) -gt 0 ]]; then
echo 'Schema changed.';
echo ::set-output name=SCHEMACHANGED::true;
else
echo 'Schema did not change.';
echo ::set-output name=SCHEMACHANGED::false;
fi
if [[ $HOME/files.json ]] && [[ $(($(grep -oiE "DocProperty.xml|DocQuantity.xml|DocPropertySet.xml|DocQuantitySet.xml|DocPropertyConstant.xml|DocPropertyEnumeration.xml" $HOME/files.json | wc -l))) -gt 0 ]]; then
echo 'Properties or quantities changed';
echo ::set-output name=PROPSQUANTSCHANGED::true;
else
echo 'Properties and quantities did not change.';
echo ::set-output name=PROPSQUANTSCHANGED::false;
fi
generate-schema:
runs-on: ubuntu-latest
needs: [filter_schema_modifications]
if: ${{ needs.filter_schema_modifications.outputs.schema_change == 'true' }}
# defaults:
# run:
# shell: pwsh
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run schema generation
env:
wtoken: ${{ secrets.WORKFLOW }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
run: | # & "${{ github.workspace }}\build\IfcDocLite.exe" "${{ github.workspace }}\IFC4x3" -FE
echo $wtoken | gh auth login --with-token
gh workflow run schema-generation
generate-properties-quantities-listings:
runs-on: ubuntu-latest
needs: [filter_schema_modifications]
if: ${{ needs.filter_schema_modifications.outputs.prop_quants_change == 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run schema generation
env:
wtoken: ${{ secrets.WORKFLOW }}
run: |
echo $wtoken | gh auth login --with-token
gh workflow run property-quantity-listings-generation