diff options
Diffstat (limited to 'tools/ci')
-rwxr-xr-x | tools/ci/actions/check-changes-modified.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/ci/actions/check-changes-modified.sh b/tools/ci/actions/check-changes-modified.sh index e989e964b9..04c221c350 100755 --- a/tools/ci/actions/check-changes-modified.sh +++ b/tools/ci/actions/check-changes-modified.sh @@ -18,7 +18,12 @@ set -e # Hygiene Checks: check that Changes has been updated in PRs # One of the following must be true: # - A commit in the PR alters the Changes file -# - The no-change-entry-needed label is applied to the PR (handled in YAML) +# - The no-change-entry-needed label is applied to the PR + +API_URL="$1" +shift 1 + +AUTH="authorization: Bearer $GITHUB_TOKEN" # We need all the commits in the PR to be available . tools/ci/actions/deepen-fetch.sh @@ -26,8 +31,13 @@ set -e MSG='Check Changes has been updated' COMMIT_RANGE="$MERGE_BASE..$PR_HEAD" +LABEL='no-change-entry-needed' # Check if Changes has been updated in the PR -if git diff "$COMMIT_RANGE" --name-only --exit-code Changes > /dev/null; then +if ! git diff "$COMMIT_RANGE" --name-only --exit-code Changes > /dev/null; then + echo -e "$MSG: \e[32mYES\e[0m" +elif curl --silent --header "$AUTH" "$API_URL/labels" | grep -q "$LABEL"; then + echo -e "$MSG: \e[33mSKIP\e[0m" +else echo -e "$MSG: \e[31mNO\e[0m" cat <<"EOF" ------------------------------------------------------------------------ @@ -42,6 +52,4 @@ using the "no-change-entry-needed" label on the github pull request. ------------------------------------------------------------------------ EOF exit 1 -else - echo -e "$MSG: \e[32mYES\e[0m" fi |