Skip to content

Commit 34f244c

Browse files
authored
Reorg data pipeline (#10)
2 parents 8860ae1 + 8b6b0be commit 34f244c

File tree

8 files changed

+32
-18
lines changed

8 files changed

+32
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
set -eu
33

4+
# reads repository JSON text from stdin
45
# remove archived repositories, and the reference to this repository
6+
# print resulting JSON text to stdout
57

68
cat | jq '[.[] | select(.archived==false) | select(.name!="cal-itp.github.io")]'

.github/bin/repos/get.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
# print public Cal-ITP source repositories as JSON text to stdout
5+
# see https://docs.github.com/en/rest/reference/repos#list-organization-repositories
6+
7+
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/orgs/cal-itp/repos?type=source

.github/bin/repos/pipeline.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
# run the repository data pipeline: get > filter > sort > output
5+
6+
source=.github/bin/repos
7+
target=_data/repos.json
8+
9+
$source/get.sh | $source/filter.sh | $source/sort.sh > "$target"
10+
11+
# save resulting file name in GitHub Actions context
12+
# see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter
13+
14+
echo "::set-output name=data_file::$target"

.github/bin/repos/sort.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
# reads repository JSON text from stdin
5+
# sort by lowercase name
6+
# print resulting JSON text to stdout
7+
8+
cat | jq "sort_by(.name | ascii_downcase)"

.github/workflows/update-repo-data.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- name: Update local repository data
2222
id: pipeline
23-
run: ./bin/pipeline.sh repos
23+
run: ./.github/bin/repos/pipeline.sh
2424

2525
- name: Commit updated data
2626
id: commit

bin/pipeline.sh

-9
This file was deleted.

bin/repos/get.sh

-4
This file was deleted.

bin/repos/sort.sh

-4
This file was deleted.

0 commit comments

Comments
 (0)