-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from rewanthtammana/validation
Adds webhook to validate duplicate tool name
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 | ||
echo "Total entries = " $(cat *.json | jq '.name' | sort | wc -l) | ||
echo "Unique entries = " $(cat *.json | jq '.name' | sort | uniq -i | wc -l) | ||
if [ $(cat *.json | jq '.name' | sort | uniq -i | wc -l) -ne $(cat *.json | jq '.name' | sort | wc -l) ]; echo "Duplicate entries list"; cat *.json | jq '.name' | sort | uniq -i -c -d; then exit 1; fi | ||
- name: List files in the repository | ||
run: | | ||
ls ${{ github.workspace }} | ||
- run: echo "🍏 This job's status is ${{ job.status }}." |