Skip to content

Commit 67c1e05

Browse files
committed
keep github.tsv sorted
1 parent eb6cc1b commit 67c1e05

5 files changed

Lines changed: 44 additions & 4 deletions

File tree

.githooks/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
if git diff --cached --name-only | grep -q '^github\.tsv$'; then
3+
scripts/check-sorted.sh --fix
4+
git add github.tsv
5+
fi

.github/workflows/check-sorted.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check github.tsv is sorted
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
check-sorted:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Verify github.tsv is sorted
13+
run: scripts/check-sorted.sh

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ Finally, issue the following commands to download JSON files about each project
2626
A file called `data.tsv` should result, representing the data you just downloaded. Again, it should look something like the tsv file described above or the one at http://dx.doi.org/10.7910/DVN/TJCLKP .
2727

2828
If you have any trouble with the commands above or have any ideas for this project, please open a GitHub issue. Pull request are also very welcome!
29+
30+
## Keeping github.tsv sorted
31+
32+
After cloning, run this once to enable the pre-commit hook that keeps `github.tsv` sorted:
33+
34+
git config core.hooksPath .githooks

github.tsv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ https://github.com/DRSC-FG/gene2function
6464
https://github.com/farhat-lab/gentb-site
6565
https://github.com/fasrc/helmod
6666
https://github.com/FilteredPush/event_date_qc
67-
https://github.com/FilteredPush/sci_name_qc
68-
https://github.com/FilteredPush/geo_ref_qc
6967
https://github.com/FilteredPush/FP-KurationServices
68+
https://github.com/FilteredPush/geo_ref_qc
69+
https://github.com/FilteredPush/sci_name_qc
7070
https://github.com/glue-viz/glue
7171
https://github.com/harvard-dce/canvas-docker
7272
https://github.com/harvard-dce/dce_lti
@@ -110,7 +110,6 @@ https://github.com/HarvardOpenData/propublica-data
110110
https://github.com/HarvardPL/shill
111111
https://github.com/HarvardX/edx_course_templater
112112
https://github.com/HarvardX/studio-advanced
113-
https://github.com/HBRGTech/daisy
114113
https://github.com/hbctraining/Intro-to-bulk-RNAseq
115114
https://github.com/hbctraining/Intro-to-DGE
116115
https://github.com/hbctraining/Intro-to-peak-analysis
@@ -122,6 +121,7 @@ https://github.com/hbctraining/Pseudobulk-for-scRNAseq
122121
https://github.com/hbctraining/Shell-for-bioinformatics
123122
https://github.com/hbctraining/Tools-for-reproducible-research
124123
https://github.com/hbctraining/Training-modules
124+
https://github.com/HBRGTech/daisy
125125
https://github.com/hms-dbmi/scde
126126
https://github.com/hms-dbmi/UpSetR
127127
https://github.com/hms-dbmi/viv
@@ -161,7 +161,7 @@ https://github.com/OpenSDP/nearly-unique-stata
161161
https://github.com/OpenSDP/OpenSDPsynthR
162162
https://github.com/OpenSDP/template-r
163163
https://github.com/OpenSDP/template-stata
164-
https://github.com/Slicer/Slicer
165164
https://github.com/penzance/canvas_python_sdk
166165
https://github.com/penzance/harvard-data-tools
167166
https://github.com/refinery-platform/refinery-platform
167+
https://github.com/Slicer/Slicer

scripts/check-sorted.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
# Usage: check-sorted.sh [--fix]
3+
# Checks that github.tsv is sorted (case-insensitive, header preserved).
4+
# With --fix, sorts it in place.
5+
file=github.tsv
6+
sorted=$({ head -1 "$file"; tail -n +2 "$file" | sort -f; })
7+
if [ "$sorted" = "$(cat "$file")" ]; then
8+
exit 0
9+
fi
10+
if [ "$1" = "--fix" ]; then
11+
printf '%s\n' "$sorted" > "$file"
12+
echo "Sorted $file"
13+
else
14+
echo "$file is not sorted. Run: scripts/check-sorted.sh --fix"
15+
exit 1
16+
fi

0 commit comments

Comments
 (0)