fix readme in .github not found

This commit is contained in:
Night Kaly 2024-03-14 00:51:20 +00:00
parent 2ff2b9c2af
commit 2ac8821306
No known key found for this signature in database
GPG key ID: 8E829D3381CFEBBE

View file

@ -1,7 +1,12 @@
{{ $repo := .Get "repo" }} {{ $repo := .Get "repo" }}
{{ $url := printf "https://api.github.com/repos/night0721/%s/contents/README.md" $repo }} {{ $rootReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/README.md" $repo }}
{{ $githubDirReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/.github/README.md" $repo }}
{{ $response := getJSON $url }} {{ $response := getJSON $rootReadmeURL }}
{{ if not (isset $response "content") }}
{{ $response = getJSON $githubDirReadmeURL }}
{{ end }}
{{ with $response }} {{ with $response }}
{{ if isset . "content" }} {{ if isset . "content" }}
@ -16,3 +21,4 @@
{{ else }} {{ else }}
<p>Error fetching data from GitHub API.</p> <p>Error fetching data from GitHub API.</p>
{{ end }} {{ end }}