-
-
Notifications
You must be signed in to change notification settings - Fork 11
34 lines (29 loc) · 971 Bytes
/
check-duplicate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Check Duplicate
on:
workflow_dispatch:
pull_request:
permissions:
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
check-duplicate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for duplicates
shell: bash
run: |
FILE='extensions/quarto-extensions.csv'
COLUMN=2
duplicates=$(awk -F, -v col=$COLUMN '{print $col}' $FILE | sort | uniq -d)
if [[ -n "$duplicates" ]]; then
while read -r duplicate; do
grep -n "$duplicate" $FILE | tail -n +2 | while read -r line ; do
lineNumber=$(echo $line | cut -d: -f1)
echo "::error file=$FILE,line=$lineNumber,endLine=$lineNumber,title=Duplicate Entry::Duplicate value '$duplicate' found"
done
done <<< "$duplicates"
exit 1
fi