@@ -3,6 +3,11 @@ test_that("github_resolve_ref.github_release", {
3
3
skip_on_cran()
4
4
skip_if_offline()
5
5
skip_if_over_rate_limit()
6
+ # skip in GHA PRs, no token
7
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
8
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
9
+ skip(" GHA pull request, no token" )
10
+ }
6
11
7
12
expect_error(
8
13
github_resolve_ref.github_release(
@@ -38,6 +43,11 @@ test_that("github_resolve_ref.github_release", {
38
43
skip_on_cran()
39
44
skip_if_offline()
40
45
skip_if_over_rate_limit()
46
+ # skip in GHA PRs, no token
47
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
48
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
49
+ skip(" GHA pull request, no token" )
50
+ }
41
51
42
52
expect_error(
43
53
github_resolve_ref(
@@ -54,6 +64,11 @@ test_that("github_release", {
54
64
skip_on_cran()
55
65
skip_if_offline()
56
66
skip_if_over_rate_limit()
67
+ # skip in GHA PRs, no token
68
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
69
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
70
+ skip(" GHA pull request, no token" )
71
+ }
57
72
58
73
Sys.unsetenv(" R_TESTS" )
59
74
@@ -79,6 +94,11 @@ test_that("install_github", {
79
94
skip_on_cran()
80
95
skip_if_offline()
81
96
skip_if_over_rate_limit()
97
+ # skip in GHA PRs, no token
98
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
99
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
100
+ skip(" GHA pull request, no token" )
101
+ }
82
102
83
103
Sys.unsetenv(" R_TESTS" )
84
104
@@ -110,6 +130,11 @@ test_that("error if not username, warning if given as argument", {
110
130
skip_on_cran()
111
131
skip_if_offline()
112
132
skip_if_over_rate_limit()
133
+ # skip in GHA PRs, no token
134
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
135
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
136
+ skip(" GHA pull request, no token" )
137
+ }
113
138
114
139
Sys.unsetenv(" R_TESTS" )
115
140
@@ -153,6 +178,11 @@ test_that("remote_sha.github_remote", {
153
178
skip_on_cran()
154
179
skip_if_offline()
155
180
skip_if_over_rate_limit()
181
+ # skip in GHA PRs, no token
182
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
183
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
184
+ skip(" GHA pull request, no token" )
185
+ }
156
186
157
187
expect_equal(
158
188
remote_sha.github_remote(
@@ -176,6 +206,11 @@ test_that("github_remote with deleted branch", {
176
206
# skip this test unless we are using curl
177
207
skip_if(is_standalone() || ! pkg_installed(" curl" ))
178
208
209
+ # skip in GHA PRs, no token
210
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
211
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
212
+ skip(" GHA pull request, no token" )
213
+ }
179
214
180
215
expect_equal(
181
216
remote_sha.github_remote(
@@ -198,6 +233,11 @@ test_that("github_pull", {
198
233
skip_on_cran()
199
234
skip_if_offline()
200
235
skip_if_over_rate_limit()
236
+ # skip in GHA PRs, no token
237
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
238
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
239
+ skip(" GHA pull request, no token" )
240
+ }
201
241
202
242
Sys.unsetenv(" R_TESTS" )
203
243
@@ -222,6 +262,11 @@ test_that("remote_sha.github_remote errors if remote doesn't exist", {
222
262
skip_on_cran()
223
263
skip_if_offline()
224
264
skip_if_over_rate_limit()
265
+ # skip in GHA PRs, no token
266
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
267
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
268
+ skip(" GHA pull request, no token" )
269
+ }
225
270
226
271
expect_error(remote_sha(github_remote(" arst/arst" )))
227
272
})
@@ -230,6 +275,11 @@ test_that("remote_sha.github_remote returns expected value if remote does exist"
230
275
skip_on_cran()
231
276
skip_if_offline()
232
277
skip_if_over_rate_limit()
278
+ # skip in GHA PRs, no token
279
+ if (Sys.getenv(" GITHUB_ACTIONS" ) == " true" &&
280
+ startsWith(Sys.getenv(" GITHUB_REF" ), " refs/pull" )) {
281
+ skip(" GHA pull request, no token" )
282
+ }
233
283
234
284
expect_equal(remote_sha(github_remote(" r-lib/devtools@v1.8.0" )), " ad9aac7b9a522354e1ff363a86f389e32cec181b" )
235
285
})
0 commit comments