Skip to content

Commit

Permalink
Migrate to remote resource
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Mar 4, 2024
1 parent 3271cdf commit 0f00c87
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions layouts/shortcodes/github/stats.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@
{{- end -}}

{{/* Get SPDX IDs for OSI-approved licenses. */}}
{{- $licenseData := getJSON "https://github.com/spdx/license-list-data/raw/main/json/licenses.json" -}}
{{- $osiApprovedLicenses := slice -}}
{{- range (where $licenseData.licenses "isOsiApproved" true) -}}
{{- $osiApprovedLicenses = append .licenseId $osiApprovedLicenses -}}
{{- with resources.GetRemote "https://github.com/spdx/license-list-data/raw/main/json/licenses.json" -}}
{{- with .Err -}}{{- errorf "%s" . -}}{{- end -}}
{{- with .Content | transform.Unmarshal -}}
{{- range (where .licenses "isOsiApproved" true) -}}
{{- $osiApprovedLicenses = append .licenseId $osiApprovedLicenses -}}
{{- end -}}
{{- else -}}
{{- errorf "Unable to parse SPDX license list response." -}}
{{- end -}}
{{- else -}}
{{- errorf "Unable to get SPDX license list response." -}}
{{- end -}}

{{- $githubHeaders := dict -}}
Expand Down

0 comments on commit 0f00c87

Please sign in to comment.