From 9fbbc555e7e44a42cd21299ad3fc6b9059a1e7b6 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Tue, 10 Oct 2023 23:14:31 +0200 Subject: [PATCH] [GHA issue metrics] Make the codeowners uniq (#598) * Make the list of CODEOWNERS uniq. Mostly a cosmetic change to make the SEARCH_QUERY shorter * Use sparse-checkout for the 2nd job as well --- .github/workflows/pattern-metrics.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pattern-metrics.yaml b/.github/workflows/pattern-metrics.yaml index f101a4a6d..4359a43ca 100644 --- a/.github/workflows/pattern-metrics.yaml +++ b/.github/workflows/pattern-metrics.yaml @@ -44,7 +44,7 @@ jobs: # Extract words from CODEOWNERS that start with @ and convert them into a comma-separated string # ie, "-author:spier -author:zkoppert" # This will be used to filter out these codeowners from certain stats in later steps - CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | tr '\n' ' ') + CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | sort | uniq | tr '\n' ' ') # Print usernames to terminal for easy debugging echo "CODEOWNERS_FILTER: $CODEOWNERS_FILTER" @@ -89,6 +89,10 @@ jobs: - name: Check out the code so we can get the CODEOWNERS names uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/CODEOWNERS + sparse-checkout-cone-mode: false - name: Get usernames from CODEOWNERS file shell: bash @@ -99,7 +103,7 @@ jobs: # Extract words from CODEOWNERS that start with @ and convert them into a comma-separated string # ie, "-author:spier -author:zkoppert" # This will be used to filter out these codeowners from certain stats in later steps - CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | tr '\n' ' ') + CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | sort | uniq | tr '\n' ' ') # Print usernames to terminal for easy debugging echo "CODEOWNERS_FILTER: $CODEOWNERS_FILTER"