#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

set -eux
cd smithy-rs

if [[ $# -ne 1 ]]; then
    echo "Usage: generate-codegen-diff <base-revision>"
    exit 1
fi

# Override version commit hash to prevent unnecessary diffs
export SMITHY_RS_VERSION_COMMIT_HASH_OVERRIDE=ci
base_revision="$1"
./tools/ci-scripts/codegen-diff/codegen-diff-revisions.py . "${base_revision}"

mv tmp-codegen-diff/bot-message ../artifacts/bot-message-codegen-diff
mv tmp-codegen-diff ../artifacts/codegen-diff
