google.golang.org/grpc@v1.72.2/.github/workflows/deps.yml (about) 1 name: Dependency Changes 2 3 # Trigger on PRs. 4 on: 5 pull_request: 6 7 permissions: 8 contents: read 9 10 jobs: 11 # Compare dependencies before and after this PR. 12 dependencies: 13 runs-on: ubuntu-latest 14 timeout-minutes: 10 15 strategy: 16 fail-fast: true 17 18 steps: 19 - name: Checkout repo 20 uses: actions/checkout@v4 21 with: 22 fetch-depth: 0 23 24 - name: Setup Go 25 uses: actions/setup-go@v5 26 with: 27 go-version: stable 28 cache-dependency-path: "**/*go.sum" 29 30 # Run the commands to generate dependencies before and after and compare. 31 - name: Compare dependencies 32 run: | 33 set -eu 34 TEMP_DIR="$(mktemp -d)" 35 # GITHUB_BASE_REF is set when the job is triggered by a PR. 36 TARGET_REF="${GITHUB_BASE_REF:-master}" 37 38 mkdir "${TEMP_DIR}/after" 39 scripts/gen-deps.sh "${TEMP_DIR}/after" 40 41 git checkout "origin/${TARGET_REF}" 42 mkdir "${TEMP_DIR}/before" 43 scripts/gen-deps.sh "${TEMP_DIR}/before" 44 45 echo "Comparing dependencies..." 46 cd "${TEMP_DIR}" 47 # Run grep in a sub-shell since bash does not support ! in the middle of a pipe 48 diff -u0 -r "before" "after" | bash -c '! grep -v "@@"' 49 echo "No changes detected."