Skip to content

Commit

Permalink
[GHA issue metrics] Make the codeowners uniq (#598)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
spier authored Oct 10, 2023
1 parent abe2705 commit 9fbbc55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pattern-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 9fbbc55

Please sign in to comment.