From 181db7984d6323fe754a7d4dd2a99389017ce506 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 13 Feb 2024 12:50:23 +0100 Subject: [PATCH] tooling: updating the data api differ tooling to pass in the source data type --- .../workflows/automation-data-api-differ.yaml | 10 +++---- ...on-determine-changes-to-api-definitions.sh | 26 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/automation-data-api-differ.yaml b/.github/workflows/automation-data-api-differ.yaml index 82ca5247b33..0fcfe9c766c 100644 --- a/.github/workflows/automation-data-api-differ.yaml +++ b/.github/workflows/automation-data-api-differ.yaml @@ -1,5 +1,5 @@ --- -name: Detect changes to the API Definitions +name: Detect changes to the API Definitions (Resource Manager) on: pull_request: types: ['opened', 'synchronize'] @@ -26,19 +26,19 @@ jobs: - name: Detect Changes run: | - ./scripts/automation-determine-changes-to-api-definitions.sh outputs/ + ./scripts/automation-determine-changes-to-api-definitions.sh resource-manager outputs/ - name: Post Comment containing Breaking Changes uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 # v2.4.3 with: - filePath: outputs/breaking-changes.md + filePath: outputs/resource-manager-breaking-changes.md - name: Post Comment containing Changes uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 # v2.4.3 with: - filePath: outputs/changes.md + filePath: outputs/resource-manager-changes.md - name: Post Comment with New Static Identifiers uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308 # v2.4.3 with: - filePath: outputs/static-identifiers.md + filePath: outputs/resource-manager-static-identifiers.md diff --git a/scripts/automation-determine-changes-to-api-definitions.sh b/scripts/automation-determine-changes-to-api-definitions.sh index 827ec7209da..a84b8c73283 100755 --- a/scripts/automation-determine-changes-to-api-definitions.sh +++ b/scripts/automation-determine-changes-to-api-definitions.sh @@ -69,43 +69,47 @@ function ensureDirectoryExists { function runBreakingChangeDetector { local initialApiDefinitionsDirectory="$1" local updatedApiDefinitionsDirectory="$2" - local outputFilePath="$3" + local sourceDataType="$3" + local outputFilePath="$4" echo "Detecting Breaking Changes between ${initialApiDefinitionsDirectory} and ${updatedApiDefinitionsDirectory}.." - data-api-differ detect-breaking-changes --initial-path="${initialApiDefinitionsDirectory}" --updated-path="${updatedApiDefinitionsDirectory}" --output-file-path="${outputFilePath}" + data-api-differ "${sourceDataType}" detect-breaking-changes --initial-path="${initialApiDefinitionsDirectory}" --updated-path="${updatedApiDefinitionsDirectory}" --output-file-path="${outputFilePath}" } function runChangeDetector { local initialApiDefinitionsDirectory="$1" local updatedApiDefinitionsDirectory="$2" - local outputFilePath="$3" + local sourceDataType="$3" + local outputFilePath="$4" echo "Detecting Changes between ${initialApiDefinitionsDirectory} and ${updatedApiDefinitionsDirectory}.." - data-api-differ detect-changes --initial-path="${initialApiDefinitionsDirectory}" --updated-path="${updatedApiDefinitionsDirectory}" --output-file-path="${outputFilePath}" + data-api-differ "${sourceDataType}" detect-changes --initial-path="${initialApiDefinitionsDirectory}" --updated-path="${updatedApiDefinitionsDirectory}" --output-file-path="${outputFilePath}" } function runStaticIdentifierDetector { local initialApiDefinitionsDirectory="$1" local updatedApiDefinitionsDirectory="$2" - local outputFilePath="$3" + local sourceDataType="$3" + local outputFilePath="$4" echo "Detecting any new Static Identifiers between ${initialApiDefinitionsDirectory} and ${updatedApiDefinitionsDirectory}.." - data-api-differ output-resource-id-segments --initial-path="${initialApiDefinitionsDirectory}" --updated-path="${updatedApiDefinitionsDirectory}" --output-file-path="${outputFilePath}" + data-api-differ "${sourceDataType}" output-resource-id-segments --initial-path="${initialApiDefinitionsDirectory}" --updated-path="${updatedApiDefinitionsDirectory}" --output-file-path="${outputFilePath}" } function main { local tempDirectory="./pandora-from-main" local initialApiDefinitionsDirectory="${tempDirectory}/api-definitions" local updatedApiDefinitionsDirectory="${DIR}/api-definitions" - local outputDirectory="$1" + local sourceDataType="$1" + local outputDirectory="$2" buildAndInstallDependencies checkoutAPIDefinitionsFromMainInto "$tempDirectory" ensureDirectoryExists "$outputDirectory" - runBreakingChangeDetector "$initialApiDefinitionsDirectory" "$updatedApiDefinitionsDirectory" "${outputDirectory}/breaking-changes.md" - runChangeDetector "$initialApiDefinitionsDirectory" "$updatedApiDefinitionsDirectory" "${outputDirectory}/changes.md" - runStaticIdentifierDetector "$initialApiDefinitionsDirectory" "$updatedApiDefinitionsDirectory" "${outputDirectory}/static-identifiers.md" + runBreakingChangeDetector "$initialApiDefinitionsDirectory" "$updatedApiDefinitionsDirectory" "$sourceDataType" "${outputDirectory}/resource-manager-breaking-changes.md" + runChangeDetector "$initialApiDefinitionsDirectory" "$updatedApiDefinitionsDirectory" "$sourceDataType" "${outputDirectory}/resource-manager-changes.md" + runStaticIdentifierDetector "$initialApiDefinitionsDirectory" "$updatedApiDefinitionsDirectory" "$sourceDataType" "${outputDirectory}/resource-manager-static-identifiers.md" } -main "$1" +main "$1" "$2"