diff --git a/__tests__/data/brew.json b/__tests__/data/brew.json new file mode 100644 index 0000000..2e23b84 --- /dev/null +++ b/__tests__/data/brew.json @@ -0,0 +1 @@ +{"name":"hugo","full_name":"hugo","oldname":null,"aliases":[],"versioned_formulae":[],"desc":"Configurable static site generator","homepage":"https://gohugo.io/","versions":{"stable":"0.62.2","devel":null,"head":"HEAD","bottle":true},"revision":0,"version_scheme":0,"bottle":{"stable":{"rebuild":0,"cellar":":any_skip_relocation","prefix":"/usr/local","root_url":"https://homebrew.bintray.com/bottles","files":{"catalina":{"url":"https://homebrew.bintray.com/bottles/hugo-0.62.2.catalina.bottle.tar.gz","sha256":"354545c2c125e01a8860f83577fb4218d585fa8d38cd7f51e4228a149347fbcf"},"mojave":{"url":"https://homebrew.bintray.com/bottles/hugo-0.62.2.mojave.bottle.tar.gz","sha256":"9645b64fe6290c4c3b7591ef21139247f0fad6e49da1edd01665b3130a8f1d1a"},"high_sierra":{"url":"https://homebrew.bintray.com/bottles/hugo-0.62.2.high_sierra.bottle.tar.gz","sha256":"0ede4cbcc7536dd6b05107376637840356062273d734b4106be98b3d1732d50c"}}}},"keg_only":false,"bottle_disabled":false,"options":[],"build_dependencies":["go"],"dependencies":[],"recommended_dependencies":[],"optional_dependencies":[],"uses_from_macos":[],"requirements":[],"conflicts_with":[],"caveats":null,"installed":[],"linked_keg":null,"pinned":false,"outdated":false,"analytics":{"install":{"30d":{"hugo":24278,"hugo --HEAD":30},"90d":{"hugo":68639,"hugo --HEAD":80},"365d":{"hugo":223748,"hugo --HEAD":321}},"install_on_request":{"30d":{"hugo":23621,"hugo --HEAD":27},"90d":{"hugo":66676,"hugo --HEAD":74},"365d":{"hugo":215985,"hugo --HEAD":305}},"build_error":{"30d":{"hugo":0}}}} diff --git a/__tests__/data/github.json b/__tests__/data/github.json new file mode 100644 index 0000000..5fd1e31 --- /dev/null +++ b/__tests__/data/github.json @@ -0,0 +1,958 @@ +{ + "url": "https://api.github.com/repos/gohugoio/hugo/releases/22603992", + "assets_url": "https://api.github.com/repos/gohugoio/hugo/releases/22603992/assets", + "upload_url": "https://uploads.github.com/repos/gohugoio/hugo/releases/22603992/assets{?name,label}", + "html_url": "https://github.com/gohugoio/hugo/releases/tag/v0.62.2", + "id": 22603992, + "node_id": "MDc6UmVsZWFzZTIyNjAzOTky", + "tag_name": "v0.62.2", + "target_commitish": "master", + "name": "v0.62.2", + "draft": false, + "author": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "prerelease": false, + "created_at": "2020-01-05T18:50:35Z", + "published_at": "2020-01-05T19:35:16Z", + "assets": [ + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152845", + "id": 17152845, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODQ1", + "name": "hugo_0.62.2_checksums.txt", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "text/plain; charset=utf-8", + "state": "uploaded", + "size": 2552, + "download_count": 328, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:47Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_checksums.txt" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152874", + "id": 17152874, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODc0", + "name": "hugo_0.62.2_DragonFlyBSD-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 13188250, + "download_count": 25, + "created_at": "2020-01-05T18:58:52Z", + "updated_at": "2020-01-05T18:58:52Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_DragonFlyBSD-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152867", + "id": 17152867, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODY3", + "name": "hugo_0.62.2_FreeBSD-32bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12223449, + "download_count": 10, + "created_at": "2020-01-05T18:58:50Z", + "updated_at": "2020-01-05T18:58:53Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_FreeBSD-32bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152850", + "id": 17152850, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODUw", + "name": "hugo_0.62.2_FreeBSD-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 13195767, + "download_count": 38, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:48Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_FreeBSD-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152869", + "id": 17152869, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODY5", + "name": "hugo_0.62.2_FreeBSD-ARM.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12336796, + "download_count": 12, + "created_at": "2020-01-05T18:58:50Z", + "updated_at": "2020-01-05T18:58:51Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_FreeBSD-ARM.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152855", + "id": 17152855, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODU1", + "name": "hugo_0.62.2_Linux-32bit.deb", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/x-debian-package", + "state": "uploaded", + "size": 12226680, + "download_count": 37, + "created_at": "2020-01-05T18:58:48Z", + "updated_at": "2020-01-05T18:58:55Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-32bit.deb" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152849", + "id": 17152849, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODQ5", + "name": "hugo_0.62.2_Linux-32bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12228575, + "download_count": 31, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:48Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-32bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152858", + "id": 17152858, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODU4", + "name": "hugo_0.62.2_Linux-64bit.deb", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/x-debian-package", + "state": "uploaded", + "size": 13182646, + "download_count": 2260, + "created_at": "2020-01-05T18:58:49Z", + "updated_at": "2020-01-05T18:58:49Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-64bit.deb" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152851", + "id": 17152851, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODUx", + "name": "hugo_0.62.2_Linux-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 13192573, + "download_count": 5752, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:48Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152856", + "id": 17152856, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODU2", + "name": "hugo_0.62.2_Linux-ARM.deb", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/x-debian-package", + "state": "uploaded", + "size": 12324130, + "download_count": 47, + "created_at": "2020-01-05T18:58:48Z", + "updated_at": "2020-01-05T18:58:49Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-ARM.deb" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152854", + "id": 17152854, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODU0", + "name": "hugo_0.62.2_Linux-ARM.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12330563, + "download_count": 35, + "created_at": "2020-01-05T18:58:48Z", + "updated_at": "2020-01-05T18:58:48Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-ARM.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152857", + "id": 17152857, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODU3", + "name": "hugo_0.62.2_Linux-ARM64.deb", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/x-debian-package", + "state": "uploaded", + "size": 12113228, + "download_count": 38, + "created_at": "2020-01-05T18:58:49Z", + "updated_at": "2020-01-05T18:58:49Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-ARM64.deb" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152843", + "id": 17152843, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODQz", + "name": "hugo_0.62.2_Linux-ARM64.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12119126, + "download_count": 63, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:47Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-ARM64.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152873", + "id": 17152873, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODcz", + "name": "hugo_0.62.2_macOS-32bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12805086, + "download_count": 25, + "created_at": "2020-01-05T18:58:52Z", + "updated_at": "2020-01-05T18:58:52Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_macOS-32bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152868", + "id": 17152868, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODY4", + "name": "hugo_0.62.2_macOS-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 13765882, + "download_count": 479, + "created_at": "2020-01-05T18:58:50Z", + "updated_at": "2020-01-05T18:58:51Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_macOS-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152846", + "id": 17152846, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODQ2", + "name": "hugo_0.62.2_NetBSD-32bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12206852, + "download_count": 8, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:47Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_NetBSD-32bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152863", + "id": 17152863, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODYz", + "name": "hugo_0.62.2_NetBSD-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 13186059, + "download_count": 12, + "created_at": "2020-01-05T18:58:49Z", + "updated_at": "2020-01-05T18:58:50Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_NetBSD-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152870", + "id": 17152870, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODcw", + "name": "hugo_0.62.2_NetBSD-ARM.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12325194, + "download_count": 8, + "created_at": "2020-01-05T18:58:51Z", + "updated_at": "2020-01-05T18:58:52Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_NetBSD-ARM.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152861", + "id": 17152861, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODYx", + "name": "hugo_0.62.2_OpenBSD-32bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12208022, + "download_count": 11, + "created_at": "2020-01-05T18:58:49Z", + "updated_at": "2020-01-05T18:58:50Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_OpenBSD-32bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152871", + "id": 17152871, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODcx", + "name": "hugo_0.62.2_OpenBSD-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 13183077, + "download_count": 39, + "created_at": "2020-01-05T18:58:51Z", + "updated_at": "2020-01-05T18:58:52Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_OpenBSD-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152864", + "id": 17152864, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODY0", + "name": "hugo_0.62.2_OpenBSD-ARM.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 12322903, + "download_count": 9, + "created_at": "2020-01-05T18:58:50Z", + "updated_at": "2020-01-05T18:58:50Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_OpenBSD-ARM.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152862", + "id": 17152862, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODYy", + "name": "hugo_0.62.2_Windows-32bit.zip", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/zip", + "state": "uploaded", + "size": 12221573, + "download_count": 154, + "created_at": "2020-01-05T18:58:49Z", + "updated_at": "2020-01-05T18:58:50Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Windows-32bit.zip" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152865", + "id": 17152865, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODY1", + "name": "hugo_0.62.2_Windows-64bit.zip", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/zip", + "state": "uploaded", + "size": 13265631, + "download_count": 7902, + "created_at": "2020-01-05T18:58:50Z", + "updated_at": "2020-01-05T18:58:50Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Windows-64bit.zip" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152859", + "id": 17152859, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODU5", + "name": "hugo_extended_0.62.2_Linux-64bit.deb", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/x-debian-package", + "state": "uploaded", + "size": 14137254, + "download_count": 855, + "created_at": "2020-01-05T18:58:49Z", + "updated_at": "2020-01-05T18:58:49Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_extended_0.62.2_Linux-64bit.deb" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152844", + "id": 17152844, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODQ0", + "name": "hugo_extended_0.62.2_Linux-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 14145652, + "download_count": 5218, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:47Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_extended_0.62.2_Linux-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152852", + "id": 17152852, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODUy", + "name": "hugo_extended_0.62.2_macOS-64bit.tar.gz", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/gzip", + "state": "uploaded", + "size": 14784660, + "download_count": 628, + "created_at": "2020-01-05T18:58:47Z", + "updated_at": "2020-01-05T18:58:48Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_extended_0.62.2_macOS-64bit.tar.gz" + }, + { + "url": "https://api.github.com/repos/gohugoio/hugo/releases/assets/17152853", + "id": 17152853, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE3MTUyODUz", + "name": "hugo_extended_0.62.2_Windows-64bit.zip", + "label": "", + "uploader": { + "login": "bep", + "id": 394382, + "node_id": "MDQ6VXNlcjM5NDM4Mg==", + "avatar_url": "https://avatars1.githubusercontent.com/u/394382?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bep", + "html_url": "https://github.com/bep", + "followers_url": "https://api.github.com/users/bep/followers", + "following_url": "https://api.github.com/users/bep/following{/other_user}", + "gists_url": "https://api.github.com/users/bep/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bep/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bep/subscriptions", + "organizations_url": "https://api.github.com/users/bep/orgs", + "repos_url": "https://api.github.com/users/bep/repos", + "events_url": "https://api.github.com/users/bep/events{/privacy}", + "received_events_url": "https://api.github.com/users/bep/received_events", + "type": "User", + "site_admin": false + }, + "content_type": "application/zip", + "state": "uploaded", + "size": 30553922, + "download_count": 3681, + "created_at": "2020-01-05T18:58:48Z", + "updated_at": "2020-01-05T18:58:49Z", + "browser_download_url": "https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_extended_0.62.2_Windows-64bit.zip" + } + ], + "tarball_url": "https://api.github.com/repos/gohugoio/hugo/tarball/v0.62.2", + "zipball_url": "https://api.github.com/repos/gohugoio/hugo/zipball/v0.62.2", + "body": "The main driving force behind these patch releases in the new year has been getting a good story with [portable links](https://github.com/bep/portable-hugo-links/) between GitHub and Hugo, using the new render hooks introduced in [Hugo 0.62.0](https://gohugo.io/news/0.62.0-relnotes/). And all was mostly well until a Hugo user asked about anchor links. Which is, when you look into it, a slightly sad Markdown story. They have been [talking about anchors in Markdown](https://talk.commonmark.org/t/anchors-in-markdown/247) over at the CommonMark forum for the last six years, but it has come to nothing. The current situation is that some Markdown engines support the `{#anchorName}` attribute syntax (Hugo's Goldmark does, GitHub does not) and for those that support auto-generation of IDs, the implementation often varies. And this makes for poor portability.\r\n\r\nTo improve this, Hugo has now reverse-engineered GitHub's implementation and made that the default strategy for generation or header IDs. We understand that this isn't everyone's cup of tea, so you can [configure the behaviour](https://gohugo.io/getting-started/configuration-markup#goldmark) to be one of `github`, `github-ascii` (some client-libraries have Unicode issues) or `blackfriday` (which will match how it behaved before Hugo 0.60).\r\n\r\n* hugolib: Fix relative .Page.GetPage from bundle [196a9df5](https://github.com/gohugoio/hugo/commit/196a9df585c4744e3280f37c1c24e469fce14b8c) [@bep](https://github.com/bep) [#6705](https://github.com/gohugoio/hugo/issues/6705)\r\n* markup/goldmark: Adjust auto ID space handling [9b6e6146](https://github.com/gohugoio/hugo/commit/9b6e61464b09ffe3423fb8d7c72bddb7a9ed5b98) [@bep](https://github.com/bep) [#6710](https://github.com/gohugoio/hugo/issues/6710)\r\n* docs: Document the new autoHeadingIDType setting [d62ede8e](https://github.com/gohugoio/hugo/commit/d62ede8e9e5883e7ebb023e49b82f07b45edc1c7) [@bep](https://github.com/bep) [#6707](https://github.com/gohugoio/hugo/issues/6707)[#6616](https://github.com/gohugoio/hugo/issues/6616)\r\n* docs: Regenerate docshelper [81b7e48a](https://github.com/gohugoio/hugo/commit/81b7e48a55092203aeee8785799e6fed3928760e) [@bep](https://github.com/bep) [#6707](https://github.com/gohugoio/hugo/issues/6707)[#6616](https://github.com/gohugoio/hugo/issues/6616)\r\n* markup/goldmark: Add an optional Blackfriday auto ID strategy [16e7c112](https://github.com/gohugoio/hugo/commit/16e7c1120346bd853cf6510ffac8e94824bf2c7f) [@bep](https://github.com/bep) [#6707](https://github.com/gohugoio/hugo/issues/6707)\r\n* markup/goldmark: Make the autoID type config a string [8f071fc1](https://github.com/gohugoio/hugo/commit/8f071fc159ce9a0fc0ea14a73bde8f299bedd109) [@bep](https://github.com/bep) [#6707](https://github.com/gohugoio/hugo/issues/6707)\r\n* markup/goldmark: Simplify code [5ee1f087](https://github.com/gohugoio/hugo/commit/5ee1f0876f3ec8b79d6305298185dc821ead2d28) [@bep](https://github.com/bep) \r\n* markup/goldmark: Make auto IDs GitHub compatible [a82d2700](https://github.com/gohugoio/hugo/commit/a82d2700fcc772aada15d65b8f76913ca23f7404) [@bep](https://github.com/bep) [#6616](https://github.com/gohugoio/hugo/issues/6616)\r\n\r\n\r\n\r\n\r\n" +} diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts new file mode 100644 index 0000000..2593eff --- /dev/null +++ b/__tests__/main.test.ts @@ -0,0 +1,59 @@ +import * as main from '../src/main'; +const nock = require('nock'); +// import {FetchError} from 'node-fetch'; +import jsonTestBrew from './data/brew.json'; +// import jsonTestGithub from './data/github.json'; + +jest.setTimeout(30000); +const repo: string = 'hugo'; + +beforeEach(() => { + jest.resetModules(); +}); + +afterEach(() => { + delete process.env['INPUT_HUGO-VERSION']; + nock.cleanAll(); +}); + +describe('Integration testing run()', () => { + test('succeed in installing a custom version', async () => { + const testVersion: string = '0.61.0'; + process.env['INPUT_HUGO-VERSION'] = testVersion; + const result: main.actionResult = await main.run(); + expect(result.exitcode).toBe(0); + expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`); + }); + + test('succeed in installing the latest version', async () => { + const testVersion: string = 'latest'; + process.env['INPUT_HUGO-VERSION'] = testVersion; + nock('https://formulae.brew.sh') + .get(`/api/formula/${repo}.json`) + .reply(200, jsonTestBrew); + const result: main.actionResult = await main.run(); + expect(result.exitcode).toBe(0); + expect(result.output).toMatch('Hugo Static Site Generator v0.62.2'); + }); +}); + +describe('showVersion()', () => { + let result: main.actionResult = { + exitcode: 0, + output: '' + }; + + test('return version', async () => { + result = await main.showVersion('git', ['--version']); + expect(result.exitcode).toBe(0); + expect(result.output).toMatch(/git version/); + }); + + test('return exception', async () => { + try { + result = await main.showVersion('gitgit', ['--version']); + } catch (e) { + expect(e).toThrow(Error); + } + }); +}); diff --git a/src/index.ts b/src/index.ts index a7224c2..c14e8f1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,67 +1,3 @@ -import * as core from '@actions/core'; -import * as exec from '@actions/exec'; -import {getLatestVersion} from './get-latest-version'; -import {installer} from './installer'; +import * as main from './main'; -export interface actionResult { - exitcode: number; - output: string; -} - -export async function showVersion( - cmd: string, - args: string[] -): Promise { - try { - let result: actionResult = { - exitcode: 0, - output: '' - }; - - const options = { - listeners: { - stdout: (data: Buffer) => { - result.output += data.toString(); - } - } - }; - - result.exitcode = await exec.exec(cmd, args, options); - core.debug(` - exit code: ${result.exitcode} - stdout: ${result.output} - `); - return result; - } catch (e) { - return e; - } -} - -async function run() { - try { - const toolVersion: string = core.getInput('hugo-version'); - let installVersion: string = ''; - - let result: actionResult = { - exitcode: 0, - output: '' - }; - - if (toolVersion === '' || toolVersion === 'latest') { - installVersion = await getLatestVersion('gohugoio', 'hugo', 'brew'); - } else { - installVersion = toolVersion; - } - - core.info(`hugo version: ${installVersion}`); - await installer(installVersion); - result = await showVersion('hugo', ['version']); - - return result; - } catch (e) { - core.setFailed(`Action failed with error ${e}`); - return e; - } -} - -run(); +main.run(); diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..7ebfc21 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,65 @@ +import * as core from '@actions/core'; +import * as exec from '@actions/exec'; +import {getLatestVersion} from './get-latest-version'; +import {installer} from './installer'; + +export interface actionResult { + exitcode: number; + output: string; +} + +export async function showVersion( + cmd: string, + args: string[] +): Promise { + try { + let result: actionResult = { + exitcode: 0, + output: '' + }; + + const options = { + listeners: { + stdout: (data: Buffer) => { + result.output += data.toString(); + } + } + }; + + result.exitcode = await exec.exec(cmd, args, options); + core.debug(` + exit code: ${result.exitcode} + stdout: ${result.output} + `); + return result; + } catch (e) { + return e; + } +} + +export async function run() { + try { + const toolVersion: string = core.getInput('hugo-version'); + let installVersion: string = ''; + + let result: actionResult = { + exitcode: 0, + output: '' + }; + + if (toolVersion === '' || toolVersion === 'latest') { + installVersion = await getLatestVersion('gohugoio', 'hugo', 'brew'); + } else { + installVersion = toolVersion; + } + + core.info(`hugo version: ${installVersion}`); + await installer(installVersion); + result = await showVersion('hugo', ['version']); + + return result; + } catch (e) { + core.setFailed(`Action failed with error ${e}`); + return e; + } +}