From 0833e8b50b522e55c6e86f3165955867d8d7b361 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Wed, 11 Oct 2023 18:38:50 -0400 Subject: [PATCH] Backport of Fix BUSL license checker to skip >= 1.17.x target branches (#19152) into release/1.16.x (#19157) backport of commit 02bfe1dd83d09db6d99c9200c67c8699dbea9aac Co-authored-by: Semir Patel --- .github/scripts/license_checker.sh | 22 +++++++++++++--------- .github/workflows/license-checker.yml | 5 +---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/scripts/license_checker.sh b/.github/scripts/license_checker.sh index 6ba026f04..e001832f1 100755 --- a/.github/scripts/license_checker.sh +++ b/.github/scripts/license_checker.sh @@ -2,15 +2,19 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 +if [[ ${GITHUB_BASE_REF} == release/1.14.* ]] || [[ ${GITHUB_BASE_REF} == release/1.15.* ]] || [[ ${GITHUB_BASE_REF} == release/1.16.* ]]; then + busl_files=$(grep -r 'SPDX-License-Identifier: BUSL' . --exclude-dir .github) -busl_files=$(grep -r 'SPDX-License-Identifier: BUSL' . --exclude-dir .github) - -# If we do not find a file in .changelog/, we fail the check -if [ -n "$busl_files" ]; then - echo "Found BUSL occurrences in the PR branch! (See NET-5258 for details)" - echo -n "$busl_files" - exit 1 + if [ -n "$busl_files" ]; then + echo "Found BUSL occurrences in the PR branch! (See NET-5258 for details)" + echo -n "$busl_files" + exit 1 + else + echo "Did not find any occurrences of BUSL in the PR branch" + exit 0 + fi + echo "The variable starts with release/1.14, release/1.15, or release/1.17." else - echo "Did not find any occurrences of BUSL in the PR branch" + echo "Skipping BUSL check since ${GITHUB_BASE_REF} not one of release/1.14.*, release/1.15.*, or release/1.16.*." exit 0 -fi +fi \ No newline at end of file diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml index 747f81490..93ac36e75 100644 --- a/.github/workflows/license-checker.yml +++ b/.github/workflows/license-checker.yml @@ -7,11 +7,8 @@ name: License Checker on: pull_request: + # Logic to only apply check 1.1[4,5,6].x branches is in license_checker.sh types: [opened, synchronize] - branches: - - release/1.14.* - - release/1.15.* - - release/1.16.* jobs: # checks that the diff does not contain any reference to