File tree 4 files changed +49
-0
lines changed
4 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ name : Get latest data
3
+
4
+ on :
5
+ push :
6
+ workflow_dispatch :
7
+ schedule :
8
+ - cron : ' 5 * * * *'
9
+
10
+ jobs :
11
+ scheduled :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : Check out this repo
15
+ uses : actions/checkout@v4
16
+ with :
17
+ fetch-depth : 0
18
+ - name : Fetch latest data
19
+ run : |-
20
+ rm *.json
21
+ # Get all of the files
22
+ while IFS= read -r url; do
23
+ # Extract domain:
24
+ # 1. Remove protocol (http:// or https://)
25
+ # 2. Take everything up to the first /
26
+ # 3. Remove subdomains
27
+ # 4. Cut the .gov
28
+ domain=$(echo "$url" | sed -e 's|^[^/]*//||' -e 's|/.*$||' -e 's|.*\.\([^.]*\.[^.]*\)$|\1|' -e 's|\.gov||')
29
+ # Create filename with .json extension
30
+ filename="${domain}.json"
31
+
32
+ # Download the file and show progress
33
+ wget -O "$filename" "$url" --show-progress
34
+
35
+ echo "Downloaded: $url -> $filename"
36
+ done < urls.txt
37
+ - name : Commit and push if it changed
38
+ run : |-
39
+ git config user.name "Automated"
40
+ git config user.email "[email protected] "
41
+ git add .csv
42
+ timestamp=$(date -u)
43
+ git commit -F message.txt || exit 0
44
+ git push
Original file line number Diff line number Diff line change
1
+ .DS_Store /
Original file line number Diff line number Diff line change
1
+ https://hhs.gov/data.json
2
+ https://www.consumerfinance.gov/data.json
3
+ https://opendata.fcc.gov/data.json
4
+ https://data.cms.gov/data.json
You can’t perform that action at this time.
0 commit comments