Skip to content

Commit cc284d3

Browse files
spierrmarting
authored andcommitted
[GHA issue metrics] Make the codeowners uniq (InnerSourceCommons#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
1 parent 71930ad commit cc284d3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/pattern-metrics.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# Extract words from CODEOWNERS that start with @ and convert them into a comma-separated string
4545
# ie, "-author:spier -author:zkoppert"
4646
# This will be used to filter out these codeowners from certain stats in later steps
47-
CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | tr '\n' ' ')
47+
CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | sort | uniq | tr '\n' ' ')
4848
4949
# Print usernames to terminal for easy debugging
5050
echo "CODEOWNERS_FILTER: $CODEOWNERS_FILTER"
@@ -89,6 +89,10 @@ jobs:
8989
9090
- name: Check out the code so we can get the CODEOWNERS names
9191
uses: actions/checkout@v4
92+
with:
93+
sparse-checkout: |
94+
.github/CODEOWNERS
95+
sparse-checkout-cone-mode: false
9296

9397
- name: Get usernames from CODEOWNERS file
9498
shell: bash
@@ -99,7 +103,7 @@ jobs:
99103
# Extract words from CODEOWNERS that start with @ and convert them into a comma-separated string
100104
# ie, "-author:spier -author:zkoppert"
101105
# This will be used to filter out these codeowners from certain stats in later steps
102-
CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | tr '\n' ' ')
106+
CODEOWNERS_FILTER=$(echo $CODEOWNERS_FILE | grep -o "@[a-zA-Z0-9\-]*" | sed 's/@/-author:/g' | sort | uniq | tr '\n' ' ')
103107
104108
# Print usernames to terminal for easy debugging
105109
echo "CODEOWNERS_FILTER: $CODEOWNERS_FILTER"

0 commit comments

Comments
 (0)