Skip to content

Merge pull request #70 from suneshgovind/main #3

Merge pull request #70 from suneshgovind/main

Merge pull request #70 from suneshgovind/main #3

name: Validate duplicate entries
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "Wow ${{ github.base_ref }} - ${{ github.head_ref }}"
- run: sudo apt-get update && sudo apt-get -y install jq git
- name: Validate duplicate tool names
run: |
git clone https://github.com/${{ github.repository }} -b `echo ${{ github.ref }} | cut -d'/' -f3`
cd tools.tldr.run/tools
UNIQUE_ENTRIES=($(cat *.json | jq '.name' | sort | uniq -i | wc -l))
TOTAL_ENTRIES=($(cat *.json | jq '.name' | sort | wc -l))
echo "Total entries = " "$TOTAL_ENTRIES"
echo "Unique entries = " "$UNIQUE_ENTRIES"
if [ "$UNIQUE_ENTRIES" -ne "$TOTAL_ENTRIES" ]; then
echo "Duplicate entries list"; cat *.json | jq '.name' | sort | uniq -i -c -d; exit 1;
else
echo "No Duplicate Entries";
fi
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."