From b2166ec09a8b3a20c3ead30c23e9a3766b4de6f0 Mon Sep 17 00:00:00 2001 From: Android Bot Date: Wed, 25 Sep 2024 01:16:14 +0530 Subject: [PATCH] TP-54317 | Synced file(s) with navi-android/workflows (#12744) Co-authored-by: Shivam Goyal --- .../validate-dependency-snapshots.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/validate-dependency-snapshots.yml diff --git a/.github/workflows/validate-dependency-snapshots.yml b/.github/workflows/validate-dependency-snapshots.yml new file mode 100644 index 0000000000..a62cbbb174 --- /dev/null +++ b/.github/workflows/validate-dependency-snapshots.yml @@ -0,0 +1,46 @@ +name: Validate Dependency Snapshots + +on: + pull_request: + branches: [ master, release-* ] + merge_group: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + validate-dependency-snapshots: + runs-on: [ default ] + defaults: + run: + working-directory: android + if: github.event_name != 'merge_group' + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Search for Snapshot Dependencies + run: | + SNAPSHOT_REGEX="navi-.*=[ ]*\"[0-9]+\.[0-9]+\.[0-9]+-[0-9]{8}\.[0-9]{6}-[0-9]+\"" + + SNAPSHOT_DEPS=$(grep -E "$SNAPSHOT_REGEX" gradle/libs.versions.toml || true) + + if [[ -n "$SNAPSHOT_DEPS" ]]; then + echo "Snapshot version found in the following navi-* dependencies:" + echo "$SNAPSHOT_DEPS" + + SUMMARY_TABLE="| Search Location | Gradle Dependency | Snapshot Version |\n| :---: | :---: | :---: |" + while read -r line; do + DEP_NAME=$(echo "$line" | cut -d'=' -f1 | xargs) + DEP_VERSION=$(echo "$line" | cut -d'=' -f2 | xargs | tr -d '"') + SUMMARY_TABLE="$SUMMARY_TABLE\n| libs.versions.toml | $DEP_NAME | $DEP_VERSION |" + done <<< "$SNAPSHOT_DEPS" + + echo -e "$SUMMARY_TABLE" >> $GITHUB_STEP_SUMMARY + + echo -e "\nPlease use release versions instead of snapshot versions for the dependencies mentioned above." >> $GITHUB_STEP_SUMMARY + + exit 1 + else + echo "No snapshot versions found in navi-* dependencies." + fi