From 8feed5c9bfe74ab65c25d59571b63091963faa00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 15 Oct 2020 14:00:05 +0200 Subject: [PATCH 01/16] use vcr --- .gitattributes | 2 + DESCRIPTION | 3 +- tests/fixtures/gh_api_status.yml | 57 +++ tests/fixtures/gh_organizations.yml | 479 +++++++++++++++++++++++++ tests/testthat/helper-examplighratia.R | 17 + tests/testthat/test-api-status.R | 6 +- tests/testthat/test-organizations.R | 6 +- 7 files changed, 565 insertions(+), 5 deletions(-) create mode 100644 .gitattributes create mode 100644 tests/fixtures/gh_api_status.yml create mode 100644 tests/fixtures/gh_organizations.yml create mode 100644 tests/testthat/helper-examplighratia.R diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..165ff7a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto +tests/fixtures/**/* -diff diff --git a/DESCRIPTION b/DESCRIPTION index 6adf5ff..8aff522 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,7 +14,8 @@ LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.1 Suggests: - testthat + testthat, + vcr Config/testthat/edition: 3 Imports: purrr, diff --git a/tests/fixtures/gh_api_status.yml b/tests/fixtures/gh_api_status.yml new file mode 100644 index 0000000..85ac524 --- /dev/null +++ b/tests/fixtures/gh_api_status.yml @@ -0,0 +1,57 @@ +http_interactions: +- request: + method: get + uri: https://kctbh9vrtdwd.statuspage.io/api/v2/components.json + body: + encoding: '' + string: '' + headers: + Accept: application/json, text/xml, application/xml, */* + response: + status: + status_code: 200 + category: Success + reason: OK + message: 'Success: (200) OK' + headers: + vary: Accept,Accept-Encoding,Fastly-SSL + cache-control: max-age=0, private, must-revalidate + x-cache: MISS + content-type: application/json; charset=utf-8 + content-encoding: gzip + strict-transport-security: max-age=259200 + date: Thu, 15 Oct 2020 11:59:23 GMT + x-request-id: d9888435-3f04-4401-be5c-b9d1bfdfa015 + x-download-options: noopen + x-xss-protection: 1; mode=block + x-runtime: '0.037254' + x-permitted-cross-domain-policies: none + access-control-allow-origin: '*' + accept-ranges: bytes + x-content-type-options: nosniff + etag: W/"gz[a479c9894f51b7db286dc31cd922e7bf]" + x-statuspage-skip-logging: 'true' + x-statuspage-version: fd137a4bb14c20ce721393e5b6540ea6eebff3a3 + referrer-policy: strict-origin-when-cross-origin + age: '0' + body: + encoding: UTF-8 + file: no + string: '{"page":{"id":"kctbh9vrtdwd","name":"GitHub","url":"https://www.githubstatus.com","time_zone":"Etc/UTC","updated_at":"2020-10-15T08:57:35.302Z"},"components":[{"id":"8l4ygp009s5s","name":"Git + Operations","status":"operational","created_at":"2017-01-31T20:05:05.370Z","updated_at":"2020-09-24T02:32:00.916Z","position":1,"description":"Performance + of git clones, pulls, pushes, and associated operations","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"brv1bkgrwx7q","name":"API + Requests","status":"operational","created_at":"2017-01-31T20:01:46.621Z","updated_at":"2020-09-30T19:00:29.476Z","position":2,"description":"Requests + for GitHub APIs","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"4230lsnqdsld","name":"Webhooks","status":"operational","created_at":"2019-11-13T18:00:24.256Z","updated_at":"2020-10-13T14:51:17.928Z","position":3,"description":"Real + time HTTP callbacks of user-generated and system events","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"0l2p9nhqnxpd","name":"Visit + www.githubstatus.com for more information","status":"operational","created_at":"2018-12-05T19:39:40.838Z","updated_at":"2020-04-02T21:56:21.954Z","position":4,"description":null,"showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"kr09ddfgbfsf","name":"Issues","status":"operational","created_at":"2017-01-31T20:01:46.638Z","updated_at":"2020-10-10T00:02:16.199Z","position":5,"description":"Requests + for Issues on GitHub.com","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"hhtssxt0f5v2","name":"Pull + Requests","status":"operational","created_at":"2020-09-02T15:39:06.329Z","updated_at":"2020-10-10T00:02:49.033Z","position":6,"description":"Requests + for Pull Requests on GitHub.com","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"br0l2tvcx85d","name":"GitHub + Actions","status":"operational","created_at":"2019-11-13T18:02:19.432Z","updated_at":"2020-10-13T20:23:36.040Z","position":7,"description":"Workflows, + Compute and Orchestration for GitHub Actions","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"st3j38cctv9l","name":"GitHub + Packages","status":"operational","created_at":"2019-11-13T18:02:40.064Z","updated_at":"2020-09-08T15:50:32.845Z","position":8,"description":"API + requests and webhook delivery for GitHub Packages","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"vg70hn9s2tyj","name":"GitHub + Pages","status":"operational","created_at":"2017-01-31T20:04:33.923Z","updated_at":"2020-10-10T00:02:38.220Z","position":9,"description":"Frontend + application and API servers for Pages builds","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false}]}' + recorded_at: 2020-10-15 11:59:23 GMT + recorded_with: vcr/0.5.4, webmockr/0.7.0 diff --git a/tests/fixtures/gh_organizations.yml b/tests/fixtures/gh_organizations.yml new file mode 100644 index 0000000..de6a25a --- /dev/null +++ b/tests/fixtures/gh_organizations.yml @@ -0,0 +1,479 @@ +http_interactions: +- request: + method: get + uri: https://api.github.com/organizations?since=1 + body: + encoding: '' + string: '' + headers: + Accept: application/json, text/xml, application/xml, */* + Content-Type: '' + Authorization: token <> + response: + status: + status_code: 200 + category: Success + reason: OK + message: 'Success: (200) OK' + headers: + access-control-allow-origin: '*' + access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, + X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, + X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, + Deprecation, Sunset + cache-control: private, max-age=60, s-maxage=60 + content-encoding: gzip + content-security-policy: default-src 'none' + content-type: application/json; charset=utf-8 + date: Thu, 15 Oct 2020 11:59:24 GMT + etag: W/"6145a649ac2879a7957ff48b091b129143cbc08f7976f3c1314e5bcf6464a080" + link: ; rel="next", ; + rel="first" + referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin + server: GitHub.com + status: 200 OK + strict-transport-security: max-age=31536000; includeSubdomains; preload + transfer-encoding: chunked + vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + - Accept-Encoding + x-accepted-oauth-scopes: '' + x-content-type-options: nosniff + x-frame-options: deny + x-github-media-type: github.v3 + x-github-request-id: D9D0:179A:49C359B:54E2540:5F88399C + x-oauth-scopes: gist, notifications, repo, user + x-ratelimit-limit: '5000' + x-ratelimit-remaining: '4999' + x-ratelimit-reset: '1602766764' + x-ratelimit-used: '1' + x-xss-protection: 1; mode=block + body: + encoding: UTF-8 + file: no + string: | + [ + { + "login": "errfree", + "id": 44, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ0", + "url": "https://api.github.com/orgs/errfree", + "repos_url": "https://api.github.com/orgs/errfree/repos", + "events_url": "https://api.github.com/orgs/errfree/events", + "hooks_url": "https://api.github.com/orgs/errfree/hooks", + "issues_url": "https://api.github.com/orgs/errfree/issues", + "members_url": "https://api.github.com/orgs/errfree/members{/member}", + "public_members_url": "https://api.github.com/orgs/errfree/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/44?v=4", + "description": null + }, + { + "login": "engineyard", + "id": 81, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjgx", + "url": "https://api.github.com/orgs/engineyard", + "repos_url": "https://api.github.com/orgs/engineyard/repos", + "events_url": "https://api.github.com/orgs/engineyard/events", + "hooks_url": "https://api.github.com/orgs/engineyard/hooks", + "issues_url": "https://api.github.com/orgs/engineyard/issues", + "members_url": "https://api.github.com/orgs/engineyard/members{/member}", + "public_members_url": "https://api.github.com/orgs/engineyard/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/81?v=4", + "description": "" + }, + { + "login": "ministrycentered", + "id": 119, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExOQ==", + "url": "https://api.github.com/orgs/ministrycentered", + "repos_url": "https://api.github.com/orgs/ministrycentered/repos", + "events_url": "https://api.github.com/orgs/ministrycentered/events", + "hooks_url": "https://api.github.com/orgs/ministrycentered/hooks", + "issues_url": "https://api.github.com/orgs/ministrycentered/issues", + "members_url": "https://api.github.com/orgs/ministrycentered/members{/member}", + "public_members_url": "https://api.github.com/orgs/ministrycentered/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/119?v=4", + "description": "" + }, + { + "login": "collectiveidea", + "id": 128, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEyOA==", + "url": "https://api.github.com/orgs/collectiveidea", + "repos_url": "https://api.github.com/orgs/collectiveidea/repos", + "events_url": "https://api.github.com/orgs/collectiveidea/events", + "hooks_url": "https://api.github.com/orgs/collectiveidea/hooks", + "issues_url": "https://api.github.com/orgs/collectiveidea/issues", + "members_url": "https://api.github.com/orgs/collectiveidea/members{/member}", + "public_members_url": "https://api.github.com/orgs/collectiveidea/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/128?v=4", + "description": "We build software to solve real problems." + }, + { + "login": "ogc", + "id": 144, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0NA==", + "url": "https://api.github.com/orgs/ogc", + "repos_url": "https://api.github.com/orgs/ogc/repos", + "events_url": "https://api.github.com/orgs/ogc/events", + "hooks_url": "https://api.github.com/orgs/ogc/hooks", + "issues_url": "https://api.github.com/orgs/ogc/issues", + "members_url": "https://api.github.com/orgs/ogc/members{/member}", + "public_members_url": "https://api.github.com/orgs/ogc/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/144?v=4", + "description": "" + }, + { + "login": "sevenwire", + "id": 150, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE1MA==", + "url": "https://api.github.com/orgs/sevenwire", + "repos_url": "https://api.github.com/orgs/sevenwire/repos", + "events_url": "https://api.github.com/orgs/sevenwire/events", + "hooks_url": "https://api.github.com/orgs/sevenwire/hooks", + "issues_url": "https://api.github.com/orgs/sevenwire/issues", + "members_url": "https://api.github.com/orgs/sevenwire/members{/member}", + "public_members_url": "https://api.github.com/orgs/sevenwire/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/150?v=4", + "description": "" + }, + { + "login": "entryway", + "id": 167, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2Nw==", + "url": "https://api.github.com/orgs/entryway", + "repos_url": "https://api.github.com/orgs/entryway/repos", + "events_url": "https://api.github.com/orgs/entryway/events", + "hooks_url": "https://api.github.com/orgs/entryway/hooks", + "issues_url": "https://api.github.com/orgs/entryway/issues", + "members_url": "https://api.github.com/orgs/entryway/members{/member}", + "public_members_url": "https://api.github.com/orgs/entryway/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/167?v=4", + "description": "" + }, + { + "login": "merb", + "id": 264, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjI2NA==", + "url": "https://api.github.com/orgs/merb", + "repos_url": "https://api.github.com/orgs/merb/repos", + "events_url": "https://api.github.com/orgs/merb/events", + "hooks_url": "https://api.github.com/orgs/merb/hooks", + "issues_url": "https://api.github.com/orgs/merb/issues", + "members_url": "https://api.github.com/orgs/merb/members{/member}", + "public_members_url": "https://api.github.com/orgs/merb/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/264?v=4", + "description": null + }, + { + "login": "moneyspyder", + "id": 359, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjM1OQ==", + "url": "https://api.github.com/orgs/moneyspyder", + "repos_url": "https://api.github.com/orgs/moneyspyder/repos", + "events_url": "https://api.github.com/orgs/moneyspyder/events", + "hooks_url": "https://api.github.com/orgs/moneyspyder/hooks", + "issues_url": "https://api.github.com/orgs/moneyspyder/issues", + "members_url": "https://api.github.com/orgs/moneyspyder/members{/member}", + "public_members_url": "https://api.github.com/orgs/moneyspyder/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/359?v=4", + "description": null + }, + { + "login": "sproutit", + "id": 374, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjM3NA==", + "url": "https://api.github.com/orgs/sproutit", + "repos_url": "https://api.github.com/orgs/sproutit/repos", + "events_url": "https://api.github.com/orgs/sproutit/events", + "hooks_url": "https://api.github.com/orgs/sproutit/hooks", + "issues_url": "https://api.github.com/orgs/sproutit/issues", + "members_url": "https://api.github.com/orgs/sproutit/members{/member}", + "public_members_url": "https://api.github.com/orgs/sproutit/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/374?v=4", + "description": null + }, + { + "login": "wrenchlabs", + "id": 489, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ4OQ==", + "url": "https://api.github.com/orgs/wrenchlabs", + "repos_url": "https://api.github.com/orgs/wrenchlabs/repos", + "events_url": "https://api.github.com/orgs/wrenchlabs/events", + "hooks_url": "https://api.github.com/orgs/wrenchlabs/hooks", + "issues_url": "https://api.github.com/orgs/wrenchlabs/issues", + "members_url": "https://api.github.com/orgs/wrenchlabs/members{/member}", + "public_members_url": "https://api.github.com/orgs/wrenchlabs/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/489?v=4", + "description": null + }, + { + "login": "ipvideomarketinfo", + "id": 555, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU1NQ==", + "url": "https://api.github.com/orgs/ipvideomarketinfo", + "repos_url": "https://api.github.com/orgs/ipvideomarketinfo/repos", + "events_url": "https://api.github.com/orgs/ipvideomarketinfo/events", + "hooks_url": "https://api.github.com/orgs/ipvideomarketinfo/hooks", + "issues_url": "https://api.github.com/orgs/ipvideomarketinfo/issues", + "members_url": "https://api.github.com/orgs/ipvideomarketinfo/members{/member}", + "public_members_url": "https://api.github.com/orgs/ipvideomarketinfo/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/555?v=4", + "description": "" + }, + { + "login": "revelation", + "id": 728, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjcyOA==", + "url": "https://api.github.com/orgs/revelation", + "repos_url": "https://api.github.com/orgs/revelation/repos", + "events_url": "https://api.github.com/orgs/revelation/events", + "hooks_url": "https://api.github.com/orgs/revelation/hooks", + "issues_url": "https://api.github.com/orgs/revelation/issues", + "members_url": "https://api.github.com/orgs/revelation/members{/member}", + "public_members_url": "https://api.github.com/orgs/revelation/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/728?v=4", + "description": "" + }, + { + "login": "railslove", + "id": 1067, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEwNjc=", + "url": "https://api.github.com/orgs/railslove", + "repos_url": "https://api.github.com/orgs/railslove/repos", + "events_url": "https://api.github.com/orgs/railslove/events", + "hooks_url": "https://api.github.com/orgs/railslove/hooks", + "issues_url": "https://api.github.com/orgs/railslove/issues", + "members_url": "https://api.github.com/orgs/railslove/members{/member}", + "public_members_url": "https://api.github.com/orgs/railslove/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/1067?v=4", + "description": "We're an agile team building new products for the web. And oh boy, we're kind of good at it. Want to work with us?" + }, + { + "login": "railsdog", + "id": 1119, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExMTk=", + "url": "https://api.github.com/orgs/railsdog", + "repos_url": "https://api.github.com/orgs/railsdog/repos", + "events_url": "https://api.github.com/orgs/railsdog/events", + "hooks_url": "https://api.github.com/orgs/railsdog/hooks", + "issues_url": "https://api.github.com/orgs/railsdog/issues", + "members_url": "https://api.github.com/orgs/railsdog/members{/member}", + "public_members_url": "https://api.github.com/orgs/railsdog/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/1119?v=4", + "description": "Leading Spree Commerce Integration Partner" + }, + { + "login": "netguru", + "id": 1146, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNDY=", + "url": "https://api.github.com/orgs/netguru", + "repos_url": "https://api.github.com/orgs/netguru/repos", + "events_url": "https://api.github.com/orgs/netguru/events", + "hooks_url": "https://api.github.com/orgs/netguru/hooks", + "issues_url": "https://api.github.com/orgs/netguru/issues", + "members_url": "https://api.github.com/orgs/netguru/members{/member}", + "public_members_url": "https://api.github.com/orgs/netguru/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/1146?v=4", + "description": "Building software for world changers" + }, + { + "login": "animikii", + "id": 1190, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExOTA=", + "url": "https://api.github.com/orgs/animikii", + "repos_url": "https://api.github.com/orgs/animikii/repos", + "events_url": "https://api.github.com/orgs/animikii/events", + "hooks_url": "https://api.github.com/orgs/animikii/hooks", + "issues_url": "https://api.github.com/orgs/animikii/issues", + "members_url": "https://api.github.com/orgs/animikii/members{/member}", + "public_members_url": "https://api.github.com/orgs/animikii/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/1190?v=4", + "description": "" + }, + { + "login": "cdr", + "id": 1375, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNzU=", + "url": "https://api.github.com/orgs/cdr", + "repos_url": "https://api.github.com/orgs/cdr/repos", + "events_url": "https://api.github.com/orgs/cdr/events", + "hooks_url": "https://api.github.com/orgs/cdr/hooks", + "issues_url": "https://api.github.com/orgs/cdr/issues", + "members_url": "https://api.github.com/orgs/cdr/members{/member}", + "public_members_url": "https://api.github.com/orgs/cdr/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/1375?v=4", + "description": "We make it easy to write more code." + }, + { + "login": "sauspiel", + "id": 1511, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE1MTE=", + "url": "https://api.github.com/orgs/sauspiel", + "repos_url": "https://api.github.com/orgs/sauspiel/repos", + "events_url": "https://api.github.com/orgs/sauspiel/events", + "hooks_url": "https://api.github.com/orgs/sauspiel/hooks", + "issues_url": "https://api.github.com/orgs/sauspiel/issues", + "members_url": "https://api.github.com/orgs/sauspiel/members{/member}", + "public_members_url": "https://api.github.com/orgs/sauspiel/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/1511?v=4", + "description": "" + }, + { + "login": "wherecloud", + "id": 1849, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NDk=", + "url": "https://api.github.com/orgs/wherecloud", + "repos_url": "https://api.github.com/orgs/wherecloud/repos", + "events_url": "https://api.github.com/orgs/wherecloud/events", + "hooks_url": "https://api.github.com/orgs/wherecloud/hooks", + "issues_url": "https://api.github.com/orgs/wherecloud/issues", + "members_url": "https://api.github.com/orgs/wherecloud/members{/member}", + "public_members_url": "https://api.github.com/orgs/wherecloud/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/1849?v=4", + "description": "" + }, + { + "login": "triveos", + "id": 1928, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE5Mjg=", + "url": "https://api.github.com/orgs/triveos", + "repos_url": "https://api.github.com/orgs/triveos/repos", + "events_url": "https://api.github.com/orgs/triveos/events", + "hooks_url": "https://api.github.com/orgs/triveos/hooks", + "issues_url": "https://api.github.com/orgs/triveos/issues", + "members_url": "https://api.github.com/orgs/triveos/members{/member}", + "public_members_url": "https://api.github.com/orgs/triveos/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/1928?v=4", + "description": null + }, + { + "login": "lincolnloop", + "id": 1964, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE5NjQ=", + "url": "https://api.github.com/orgs/lincolnloop", + "repos_url": "https://api.github.com/orgs/lincolnloop/repos", + "events_url": "https://api.github.com/orgs/lincolnloop/events", + "hooks_url": "https://api.github.com/orgs/lincolnloop/hooks", + "issues_url": "https://api.github.com/orgs/lincolnloop/issues", + "members_url": "https://api.github.com/orgs/lincolnloop/members{/member}", + "public_members_url": "https://api.github.com/orgs/lincolnloop/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/1964?v=4", + "description": "Makers of high performance web applications." + }, + { + "login": "notch8", + "id": 2084, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIwODQ=", + "url": "https://api.github.com/orgs/notch8", + "repos_url": "https://api.github.com/orgs/notch8/repos", + "events_url": "https://api.github.com/orgs/notch8/events", + "hooks_url": "https://api.github.com/orgs/notch8/hooks", + "issues_url": "https://api.github.com/orgs/notch8/issues", + "members_url": "https://api.github.com/orgs/notch8/members{/member}", + "public_members_url": "https://api.github.com/orgs/notch8/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/2084?v=4", + "description": "" + }, + { + "login": "edgecase", + "id": 2309, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIzMDk=", + "url": "https://api.github.com/orgs/edgecase", + "repos_url": "https://api.github.com/orgs/edgecase/repos", + "events_url": "https://api.github.com/orgs/edgecase/events", + "hooks_url": "https://api.github.com/orgs/edgecase/hooks", + "issues_url": "https://api.github.com/orgs/edgecase/issues", + "members_url": "https://api.github.com/orgs/edgecase/members{/member}", + "public_members_url": "https://api.github.com/orgs/edgecase/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/2309?v=4", + "description": "" + }, + { + "login": "galaxycats", + "id": 2548, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjI1NDg=", + "url": "https://api.github.com/orgs/galaxycats", + "repos_url": "https://api.github.com/orgs/galaxycats/repos", + "events_url": "https://api.github.com/orgs/galaxycats/events", + "hooks_url": "https://api.github.com/orgs/galaxycats/hooks", + "issues_url": "https://api.github.com/orgs/galaxycats/issues", + "members_url": "https://api.github.com/orgs/galaxycats/members{/member}", + "public_members_url": "https://api.github.com/orgs/galaxycats/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/2548?v=4", + "description": "" + }, + { + "login": "standout", + "id": 2595, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjI1OTU=", + "url": "https://api.github.com/orgs/standout", + "repos_url": "https://api.github.com/orgs/standout/repos", + "events_url": "https://api.github.com/orgs/standout/events", + "hooks_url": "https://api.github.com/orgs/standout/hooks", + "issues_url": "https://api.github.com/orgs/standout/issues", + "members_url": "https://api.github.com/orgs/standout/members{/member}", + "public_members_url": "https://api.github.com/orgs/standout/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/2595?v=4", + "description": "" + }, + { + "login": "trabian", + "id": 2705, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjI3MDU=", + "url": "https://api.github.com/orgs/trabian", + "repos_url": "https://api.github.com/orgs/trabian/repos", + "events_url": "https://api.github.com/orgs/trabian/events", + "hooks_url": "https://api.github.com/orgs/trabian/hooks", + "issues_url": "https://api.github.com/orgs/trabian/issues", + "members_url": "https://api.github.com/orgs/trabian/members{/member}", + "public_members_url": "https://api.github.com/orgs/trabian/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/2705?v=4", + "description": "" + }, + { + "login": "wesabe", + "id": 2842, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjI4NDI=", + "url": "https://api.github.com/orgs/wesabe", + "repos_url": "https://api.github.com/orgs/wesabe/repos", + "events_url": "https://api.github.com/orgs/wesabe/events", + "hooks_url": "https://api.github.com/orgs/wesabe/hooks", + "issues_url": "https://api.github.com/orgs/wesabe/issues", + "members_url": "https://api.github.com/orgs/wesabe/members{/member}", + "public_members_url": "https://api.github.com/orgs/wesabe/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/2842?v=4", + "description": null + }, + { + "login": "UntoThisLast", + "id": 3043, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjMwNDM=", + "url": "https://api.github.com/orgs/UntoThisLast", + "repos_url": "https://api.github.com/orgs/UntoThisLast/repos", + "events_url": "https://api.github.com/orgs/UntoThisLast/events", + "hooks_url": "https://api.github.com/orgs/UntoThisLast/hooks", + "issues_url": "https://api.github.com/orgs/UntoThisLast/issues", + "members_url": "https://api.github.com/orgs/UntoThisLast/members{/member}", + "public_members_url": "https://api.github.com/orgs/UntoThisLast/public_members{/member}", + "avatar_url": "https://avatars0.githubusercontent.com/u/3043?v=4", + "description": null + }, + { + "login": "gumgum", + "id": 3286, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjMyODY=", + "url": "https://api.github.com/orgs/gumgum", + "repos_url": "https://api.github.com/orgs/gumgum/repos", + "events_url": "https://api.github.com/orgs/gumgum/events", + "hooks_url": "https://api.github.com/orgs/gumgum/hooks", + "issues_url": "https://api.github.com/orgs/gumgum/issues", + "members_url": "https://api.github.com/orgs/gumgum/members{/member}", + "public_members_url": "https://api.github.com/orgs/gumgum/public_members{/member}", + "avatar_url": "https://avatars2.githubusercontent.com/u/3286?v=4", + "description": "" + } + ] + recorded_at: 2020-10-15 11:59:24 GMT + recorded_with: vcr/0.5.4, webmockr/0.7.0 diff --git a/tests/testthat/helper-examplighratia.R b/tests/testthat/helper-examplighratia.R new file mode 100644 index 0000000..fbf701a --- /dev/null +++ b/tests/testthat/helper-examplighratia.R @@ -0,0 +1,17 @@ +library("vcr") + +vcr_dir <- "../fixtures" + +if (!nzchar(Sys.getenv("GITHUB_PAT"))) { + if (dir.exists(vcr_dir)) { + Sys.setenv("GITHUB_PAT" = "foobar") + } else { + stop("No API key nor cassettes, tests cannot be run.", + call. = FALSE) + } +} + +invisible(vcr::vcr_configure( + dir = vcr_dir, + filter_sensitive_data = list("<>" = Sys.getenv('GITHUB_PAT')) +)) diff --git a/tests/testthat/test-api-status.R b/tests/testthat/test-api-status.R index 7185bfb..a2bc1dc 100644 --- a/tests/testthat/test-api-status.R +++ b/tests/testthat/test-api-status.R @@ -1,3 +1,5 @@ -test_that("gh_api_status() works", { - testthat::expect_type(gh_api_status(), "character") +vcr::use_cassette("gh_api_status", { + test_that("gh_api_status() works", { + testthat::expect_type(gh_api_status(), "character") + }) }) diff --git a/tests/testthat/test-organizations.R b/tests/testthat/test-organizations.R index 4c4d5f8..b3d675d 100644 --- a/tests/testthat/test-organizations.R +++ b/tests/testthat/test-organizations.R @@ -1,3 +1,5 @@ -test_that("gh_organizations works", { - testthat::expect_type(gh_organizations(), "character") +vcr::use_cassette("gh_organizations", { + test_that("gh_organizations works", { + testthat::expect_type(gh_organizations(), "character") + }) }) From 66d598ae12bb7eab2db7876053baf4aca3e8c0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Fri, 16 Oct 2020 13:06:32 +0200 Subject: [PATCH 02/16] add test for error --- R/organizations.R | 2 +- tests/testthat/test-organizations.R | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/R/organizations.R b/R/organizations.R index 16bb9c9..70f49d1 100644 --- a/R/organizations.R +++ b/R/organizations.R @@ -36,7 +36,7 @@ gh_organizations <- function(since = 1) { httr::add_headers("Authorization" = paste("token", token)) ) - httr::stop_for_status(response) + httr::stop_for_status(response, task = "get data from the API, oops") content <- httr::content(response) diff --git a/tests/testthat/test-organizations.R b/tests/testthat/test-organizations.R index b3d675d..e4653ad 100644 --- a/tests/testthat/test-organizations.R +++ b/tests/testthat/test-organizations.R @@ -3,3 +3,11 @@ vcr::use_cassette("gh_organizations", { testthat::expect_type(gh_organizations(), "character") }) }) + +test_that("gh_organizations errors when the API doesn't behave", { + webmockr::enable() + stub <- webmockr::stub_request("get", "https://api.github.com/organizations?since=1") + webmockr::to_return(stub, status = 502) + expect_error(gh_organizations(), "oops") + webmockr::disable() +}) From 253a3986ad7dc793975b1431eaa0b8bc411ac66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Fri, 16 Oct 2020 13:13:39 +0200 Subject: [PATCH 03/16] add webmockr dependency --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 8aff522..c38a71c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,6 +15,7 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.1 Suggests: testthat, + webmockr, vcr Config/testthat/edition: 3 Imports: From e6e44a5881fc201971bcfc0ddb6fdcbf4ef4de93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 20 Oct 2020 14:02:31 +0200 Subject: [PATCH 04/16] better @sckott? :-) --- tests/testthat/test-api-status.R | 7 ++++--- tests/testthat/test-organizations.R | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-api-status.R b/tests/testthat/test-api-status.R index a2bc1dc..b79b720 100644 --- a/tests/testthat/test-api-status.R +++ b/tests/testthat/test-api-status.R @@ -1,5 +1,6 @@ -vcr::use_cassette("gh_api_status", { - test_that("gh_api_status() works", { - testthat::expect_type(gh_api_status(), "character") +test_that("gh_api_status() works", { + vcr::use_cassette("gh_api_status", { + status <- gh_api_status() }) + testthat::expect_type(status, "character") }) diff --git a/tests/testthat/test-organizations.R b/tests/testthat/test-organizations.R index e4653ad..64b4ffc 100644 --- a/tests/testthat/test-organizations.R +++ b/tests/testthat/test-organizations.R @@ -1,7 +1,8 @@ -vcr::use_cassette("gh_organizations", { - test_that("gh_organizations works", { - testthat::expect_type(gh_organizations(), "character") +test_that("gh_organizations works", { + vcr::use_cassette("gh_organizations", { + orgs <- gh_organizations() }) + testthat::expect_type(orgs, "character") }) test_that("gh_organizations errors when the API doesn't behave", { From 7d90f99179688424b48f49504dc2a40f316b2fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 20 Oct 2020 15:05:46 +0200 Subject: [PATCH 05/16] rename setup file --- .../testthat/{helper-examplighratia.R => setup-examplighratia.R} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/testthat/{helper-examplighratia.R => setup-examplighratia.R} (100%) diff --git a/tests/testthat/helper-examplighratia.R b/tests/testthat/setup-examplighratia.R similarity index 100% rename from tests/testthat/helper-examplighratia.R rename to tests/testthat/setup-examplighratia.R From c0236820191d1ac047961deea7c05fe616c6eaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 9 Nov 2020 11:53:57 +0100 Subject: [PATCH 06/16] try adding file --- .../workflows/R-CMD-check-real-requests.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/R-CMD-check-real-requests.yaml diff --git a/.github/workflows/R-CMD-check-real-requests.yaml b/.github/workflows/R-CMD-check-real-requests.yaml new file mode 100644 index 0000000..6dcacb4 --- /dev/null +++ b/.github/workflows/R-CMD-check-real-requests.yaml @@ -0,0 +1,77 @@ +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +on: + push: + branches: + - vcrtest + schedule: + - cron: '0 12 * * 1' +name: R-CMD-check-real-requests + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: 'release'} + - {os: macOS-latest, r: 'release', vcrturnoff: 'true'} + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + VCR_TURN_OFF: ${{ matrix.config.vcrturnoff }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@master + with: + r-version: ${{ matrix.config.r }} + + - uses: r-lib/actions/setup-pandoc@master + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Cache R packages + if: runner.os != 'Windows' + uses: actions/cache@v2 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + run: | + while read -r cmd + do + eval sudo $cmd + done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') + + - name: Install dependencies + run: | + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("rcmdcheck") + shell: Rscript {0} + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_REMOTE_: false + run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@main + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check From 23bd874796c0795a4917399e19caa6aec637028c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 9 Nov 2020 11:56:54 +0100 Subject: [PATCH 07/16] comparable --- .github/workflows/R-CMD-check-real-requests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-real-requests.yaml b/.github/workflows/R-CMD-check-real-requests.yaml index 6dcacb4..bbaab20 100644 --- a/.github/workflows/R-CMD-check-real-requests.yaml +++ b/.github/workflows/R-CMD-check-real-requests.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: config: - - {os: windows-latest, r: 'release'} + - {os: macOS-latest, r: 'release'} - {os: macOS-latest, r: 'release', vcrturnoff: 'true'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true From 4c4a2f44b2c353f0a19e5152dd312c61b838f7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 9 Nov 2020 12:17:38 +0100 Subject: [PATCH 08/16] add GH token --- .github/workflows/R-CMD-check-real-requests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/R-CMD-check-real-requests.yaml b/.github/workflows/R-CMD-check-real-requests.yaml index bbaab20..7bf3211 100644 --- a/.github/workflows/R-CMD-check-real-requests.yaml +++ b/.github/workflows/R-CMD-check-real-requests.yaml @@ -24,6 +24,8 @@ jobs: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} VCR_TURN_OFF: ${{ matrix.config.vcrturnoff }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - uses: actions/checkout@v2 From 72d7ff38ae9341c7d45478a2cbf95592f4326fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 14 Dec 2020 14:40:06 +0100 Subject: [PATCH 09/16] update to latest version of vcr --- DESCRIPTION | 2 +- tests/fixtures/gh_api_status.yml | 29 ++++++++++++++------------- tests/fixtures/gh_organizations.yml | 16 +++++++-------- tests/testthat/setup-examplighratia.R | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c38a71c..049cc32 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ RoxygenNote: 7.1.1 Suggests: testthat, webmockr, - vcr + vcr ( >= 0.6.0 ) Config/testthat/edition: 3 Imports: purrr, diff --git a/tests/fixtures/gh_api_status.yml b/tests/fixtures/gh_api_status.yml index 85ac524..c39922a 100644 --- a/tests/fixtures/gh_api_status.yml +++ b/tests/fixtures/gh_api_status.yml @@ -7,6 +7,7 @@ http_interactions: string: '' headers: Accept: application/json, text/xml, application/xml, */* + Authorization: My bearer token is safe response: status: status_code: 200 @@ -20,38 +21,38 @@ http_interactions: content-type: application/json; charset=utf-8 content-encoding: gzip strict-transport-security: max-age=259200 - date: Thu, 15 Oct 2020 11:59:23 GMT - x-request-id: d9888435-3f04-4401-be5c-b9d1bfdfa015 + date: Mon, 14 Dec 2020 13:36:27 GMT + x-request-id: 1e2b60ce-b2e9-4511-8a54-2bc081178583 x-download-options: noopen x-xss-protection: 1; mode=block - x-runtime: '0.037254' + x-runtime: '0.039658' x-permitted-cross-domain-policies: none access-control-allow-origin: '*' accept-ranges: bytes x-content-type-options: nosniff - etag: W/"gz[a479c9894f51b7db286dc31cd922e7bf]" + etag: W/"gz[fd28ddd5c0e61f8f9ef06b9211fefcdd]" x-statuspage-skip-logging: 'true' - x-statuspage-version: fd137a4bb14c20ce721393e5b6540ea6eebff3a3 + x-statuspage-version: 4639ace0759d8bd9ebdda5d4637cc1b43b8e8d62 referrer-policy: strict-origin-when-cross-origin age: '0' body: encoding: UTF-8 file: no - string: '{"page":{"id":"kctbh9vrtdwd","name":"GitHub","url":"https://www.githubstatus.com","time_zone":"Etc/UTC","updated_at":"2020-10-15T08:57:35.302Z"},"components":[{"id":"8l4ygp009s5s","name":"Git - Operations","status":"operational","created_at":"2017-01-31T20:05:05.370Z","updated_at":"2020-09-24T02:32:00.916Z","position":1,"description":"Performance + string: '{"page":{"id":"kctbh9vrtdwd","name":"GitHub","url":"https://www.githubstatus.com","time_zone":"Etc/UTC","updated_at":"2020-12-14T08:04:41.926Z"},"components":[{"id":"8l4ygp009s5s","name":"Git + Operations","status":"operational","created_at":"2017-01-31T20:05:05.370Z","updated_at":"2020-10-29T22:51:43.831Z","position":1,"description":"Performance of git clones, pulls, pushes, and associated operations","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"brv1bkgrwx7q","name":"API - Requests","status":"operational","created_at":"2017-01-31T20:01:46.621Z","updated_at":"2020-09-30T19:00:29.476Z","position":2,"description":"Requests - for GitHub APIs","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"4230lsnqdsld","name":"Webhooks","status":"operational","created_at":"2019-11-13T18:00:24.256Z","updated_at":"2020-10-13T14:51:17.928Z","position":3,"description":"Real + Requests","status":"operational","created_at":"2017-01-31T20:01:46.621Z","updated_at":"2020-10-30T22:01:20.086Z","position":2,"description":"Requests + for GitHub APIs","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"4230lsnqdsld","name":"Webhooks","status":"operational","created_at":"2019-11-13T18:00:24.256Z","updated_at":"2020-11-18T23:38:14.467Z","position":3,"description":"Real time HTTP callbacks of user-generated and system events","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"0l2p9nhqnxpd","name":"Visit - www.githubstatus.com for more information","status":"operational","created_at":"2018-12-05T19:39:40.838Z","updated_at":"2020-04-02T21:56:21.954Z","position":4,"description":null,"showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"kr09ddfgbfsf","name":"Issues","status":"operational","created_at":"2017-01-31T20:01:46.638Z","updated_at":"2020-10-10T00:02:16.199Z","position":5,"description":"Requests + www.githubstatus.com for more information","status":"operational","created_at":"2018-12-05T19:39:40.838Z","updated_at":"2020-04-02T21:56:21.954Z","position":4,"description":null,"showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"kr09ddfgbfsf","name":"Issues","status":"operational","created_at":"2017-01-31T20:01:46.638Z","updated_at":"2020-11-18T23:36:59.799Z","position":5,"description":"Requests for Issues on GitHub.com","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"hhtssxt0f5v2","name":"Pull - Requests","status":"operational","created_at":"2020-09-02T15:39:06.329Z","updated_at":"2020-10-10T00:02:49.033Z","position":6,"description":"Requests + Requests","status":"operational","created_at":"2020-09-02T15:39:06.329Z","updated_at":"2020-11-18T23:36:47.289Z","position":6,"description":"Requests for Pull Requests on GitHub.com","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"br0l2tvcx85d","name":"GitHub - Actions","status":"operational","created_at":"2019-11-13T18:02:19.432Z","updated_at":"2020-10-13T20:23:36.040Z","position":7,"description":"Workflows, + Actions","status":"operational","created_at":"2019-11-13T18:02:19.432Z","updated_at":"2020-12-01T22:33:58.390Z","position":7,"description":"Workflows, Compute and Orchestration for GitHub Actions","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"st3j38cctv9l","name":"GitHub Packages","status":"operational","created_at":"2019-11-13T18:02:40.064Z","updated_at":"2020-09-08T15:50:32.845Z","position":8,"description":"API requests and webhook delivery for GitHub Packages","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false},{"id":"vg70hn9s2tyj","name":"GitHub Pages","status":"operational","created_at":"2017-01-31T20:04:33.923Z","updated_at":"2020-10-10T00:02:38.220Z","position":9,"description":"Frontend application and API servers for Pages builds","showcase":false,"start_date":null,"group_id":null,"page_id":"kctbh9vrtdwd","group":false,"only_show_if_degraded":false}]}' - recorded_at: 2020-10-15 11:59:23 GMT - recorded_with: vcr/0.5.4, webmockr/0.7.0 + recorded_at: 2020-12-14 13:36:27 GMT + recorded_with: vcr/0.6.0, webmockr/0.7.4 diff --git a/tests/fixtures/gh_organizations.yml b/tests/fixtures/gh_organizations.yml index de6a25a..b8a0e2a 100644 --- a/tests/fixtures/gh_organizations.yml +++ b/tests/fixtures/gh_organizations.yml @@ -8,7 +8,7 @@ http_interactions: headers: Accept: application/json, text/xml, application/xml, */* Content-Type: '' - Authorization: token <> + Authorization: My bearer token is safe response: status: status_code: 200 @@ -25,8 +25,8 @@ http_interactions: content-encoding: gzip content-security-policy: default-src 'none' content-type: application/json; charset=utf-8 - date: Thu, 15 Oct 2020 11:59:24 GMT - etag: W/"6145a649ac2879a7957ff48b091b129143cbc08f7976f3c1314e5bcf6464a080" + date: Mon, 14 Dec 2020 13:37:39 GMT + etag: W/"ad74ce3c94603322cddbdc174a4a9da9d0a2aa929fa4a046b86b1e7bce9d4648" link: ; rel="next", ; rel="first" referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin @@ -42,11 +42,11 @@ http_interactions: x-content-type-options: nosniff x-frame-options: deny x-github-media-type: github.v3 - x-github-request-id: D9D0:179A:49C359B:54E2540:5F88399C - x-oauth-scopes: gist, notifications, repo, user + x-github-request-id: D90E:63EF:3242529:39A76C5:5FD76AA2 + x-oauth-scopes: repo, user, workflow x-ratelimit-limit: '5000' x-ratelimit-remaining: '4999' - x-ratelimit-reset: '1602766764' + x-ratelimit-reset: '1607956659' x-ratelimit-used: '1' x-xss-protection: 1; mode=block body: @@ -475,5 +475,5 @@ http_interactions: "description": "" } ] - recorded_at: 2020-10-15 11:59:24 GMT - recorded_with: vcr/0.5.4, webmockr/0.7.0 + recorded_at: 2020-12-14 13:37:39 GMT + recorded_with: vcr/0.6.0, webmockr/0.7.4 diff --git a/tests/testthat/setup-examplighratia.R b/tests/testthat/setup-examplighratia.R index fbf701a..a7c022a 100644 --- a/tests/testthat/setup-examplighratia.R +++ b/tests/testthat/setup-examplighratia.R @@ -13,5 +13,5 @@ if (!nzchar(Sys.getenv("GITHUB_PAT"))) { invisible(vcr::vcr_configure( dir = vcr_dir, - filter_sensitive_data = list("<>" = Sys.getenv('GITHUB_PAT')) + filter_request_headers = list(Authorization = "My bearer token is safe") )) From 6594bd475df126cc2c5cb36771e5c3679279c5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 14 Dec 2020 14:50:15 +0100 Subject: [PATCH 10/16] oops --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 049cc32..93cb73c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ RoxygenNote: 7.1.1 Suggests: testthat, webmockr, - vcr ( >= 0.6.0 ) + vcr (>= 0.6.0) Config/testthat/edition: 3 Imports: purrr, From e8400860bfc7f06484d2a7f58682ae6bd204075b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 14 Dec 2020 14:51:05 +0100 Subject: [PATCH 11/16] modern --- tests/testthat/setup-examplighratia.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/setup-examplighratia.R b/tests/testthat/setup-examplighratia.R index a7c022a..3b1347d 100644 --- a/tests/testthat/setup-examplighratia.R +++ b/tests/testthat/setup-examplighratia.R @@ -1,6 +1,6 @@ library("vcr") -vcr_dir <- "../fixtures" +vcr_dir <- vcr::vcr_test_path("fixtures") if (!nzchar(Sys.getenv("GITHUB_PAT"))) { if (dir.exists(vcr_dir)) { From bcf2b48fec258f3242ec0039c9825a26a178423b Mon Sep 17 00:00:00 2001 From: Daniel Possenriede Date: Tue, 15 Nov 2022 19:18:27 +0100 Subject: [PATCH 12/16] rename `setup-exemplighratia.R` to `helper-vcr.R` --- tests/testthat/{setup-examplighratia.R => helper-vcr.R} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/testthat/{setup-examplighratia.R => helper-vcr.R} (100%) diff --git a/tests/testthat/setup-examplighratia.R b/tests/testthat/helper-vcr.R similarity index 100% rename from tests/testthat/setup-examplighratia.R rename to tests/testthat/helper-vcr.R From bcb67235ec0f762c151b0c0feb8b9f912043b5fe Mon Sep 17 00:00:00 2001 From: Daniel Possenriede Date: Tue, 15 Nov 2022 19:22:59 +0100 Subject: [PATCH 13/16] normalize `DESCRIPTION` --- DESCRIPTION | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 93cb73c..2a1c63a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,15 +9,15 @@ Authors@R: comment = c(ORCID = "0000-0002-2815-0399")) Description: What the package does (one paragraph). License: MIT + file LICENSE -Encoding: UTF-8 -LazyData: true -Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +Imports: + httr, + purrr Suggests: testthat, - webmockr, - vcr (>= 0.6.0) + vcr (>= 0.6.0), + webmockr Config/testthat/edition: 3 -Imports: - purrr, - httr +Encoding: UTF-8 +LazyData: true +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.2.2 From 30fde3d79a25cb9bf8fb93219b97dce0cbf3c4e2 Mon Sep 17 00:00:00 2001 From: Daniel Possenriede Date: Tue, 15 Nov 2022 19:39:05 +0100 Subject: [PATCH 14/16] omit LazyData --- DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2a1c63a..8178c29 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,6 +18,5 @@ Suggests: webmockr Config/testthat/edition: 3 Encoding: UTF-8 -LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.2 From 5ced3d7c5c10d4e62457e07659951d66ef893847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 22 Nov 2022 10:56:18 +0100 Subject: [PATCH 15/16] Update R-CMD-check-real-requests.yaml --- .../workflows/R-CMD-check-real-requests.yaml | 78 ++++++------------- 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/.github/workflows/R-CMD-check-real-requests.yaml b/.github/workflows/R-CMD-check-real-requests.yaml index 7bf3211..591f755 100644 --- a/.github/workflows/R-CMD-check-real-requests.yaml +++ b/.github/workflows/R-CMD-check-real-requests.yaml @@ -1,12 +1,12 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - vcrtest - schedule: - - cron: '0 12 * * 1' -name: R-CMD-check-real-requests + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check jobs: R-CMD-check: @@ -18,62 +18,30 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} - - {os: macOS-latest, r: 'release', vcrturnoff: 'true'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release', vcrturnoff: 'true'} + env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} - VCR_TURN_OFF: ${{ matrix.config.vcrturnoff }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - + R_KEEP_PKG_SOURCE: yes + VCR_TURN_OFF: ${{ matrix.config.vcrturnoff }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@master + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@master - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true From 54dd488a9ca1b5dbbe04788313148fac2f6cc5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 22 Nov 2022 10:57:05 +0100 Subject: [PATCH 16/16] Update R-CMD-check-real-requests.yaml --- .github/workflows/R-CMD-check-real-requests.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check-real-requests.yaml b/.github/workflows/R-CMD-check-real-requests.yaml index 591f755..5d16356 100644 --- a/.github/workflows/R-CMD-check-real-requests.yaml +++ b/.github/workflows/R-CMD-check-real-requests.yaml @@ -2,9 +2,10 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] - pull_request: - branches: [main, master] + branches: + - vcrtest + schedule: + - cron: '0 12 * * 1' name: R-CMD-check