File: should_build.sh

package info (click to toggle)
golang-opentelemetry-contrib 0.56.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,884 kB
  • sloc: makefile: 278; sh: 211; sed: 1
file content (27 lines) | stat: -rwxr-xr-x 700 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# Returns 0 (true) when the current diff contains files in the provided
# target directory. TARGET should be a unique package name in the directory
# structure. For example, for the gocql integration, set TARGET=gocql so that
# a diff in any of the files in the instrumentation/gocql/gocql directory
# will be picked up by the grep. Diffs are compared against the main branch.

TARGET=$1

if [ -z "$TARGET" ]; then
  echo "TARGET is undefined"
  exit 1
fi

if git diff --name-only origin/main HEAD | grep -q "$TARGET"; then
  exit 0
else
  echo "no changes found for $TARGET. skipping tests..."
  exit 1
fi