TP-54317 | Synced file(s) with navi-android/workflows (#12744)

Co-authored-by: Shivam Goyal <shivam.goyal@navi.com>
This commit is contained in:
Android Bot
2024-09-25 01:16:14 +05:30
committed by GitHub
parent ab74346b98
commit b2166ec09a

View File

@@ -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