-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GHA: skip tests that need GH token in PRs
- Loading branch information
1 parent
fa7655c
commit 6fc3b1f
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ test_that("github_resolve_ref.github_release", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
expect_error( | ||
github_resolve_ref.github_release( | ||
|
@@ -38,6 +43,11 @@ test_that("github_resolve_ref.github_release", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
expect_error( | ||
github_resolve_ref( | ||
|
@@ -54,6 +64,11 @@ test_that("github_release", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
Sys.unsetenv("R_TESTS") | ||
|
||
|
@@ -79,6 +94,11 @@ test_that("install_github", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
Sys.unsetenv("R_TESTS") | ||
|
||
|
@@ -110,6 +130,11 @@ test_that("error if not username, warning if given as argument", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
Sys.unsetenv("R_TESTS") | ||
|
||
|
@@ -153,6 +178,11 @@ test_that("remote_sha.github_remote", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
expect_equal( | ||
remote_sha.github_remote( | ||
|
@@ -176,6 +206,11 @@ test_that("github_remote with deleted branch", { | |
# skip this test unless we are using curl | ||
skip_if(is_standalone() || !pkg_installed("curl")) | ||
|
||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
expect_equal( | ||
remote_sha.github_remote( | ||
|
@@ -198,6 +233,11 @@ test_that("github_pull", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
Sys.unsetenv("R_TESTS") | ||
|
||
|
@@ -222,6 +262,11 @@ test_that("remote_sha.github_remote errors if remote doesn't exist", { | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
expect_error(remote_sha(github_remote("arst/arst"))) | ||
}) | ||
|
@@ -230,6 +275,11 @@ test_that("remote_sha.github_remote returns expected value if remote does exist" | |
skip_on_cran() | ||
skip_if_offline() | ||
skip_if_over_rate_limit() | ||
# skip in GHA PRs, no token | ||
if (Sys.getenv("GITHUB_ACTIONS") == "true" && | ||
startsWith(Sys.getenv("GITHUB_REF"), "refs/pull")) { | ||
skip("GHA pull request, no token") | ||
} | ||
|
||
expect_equal(remote_sha(github_remote("r-lib/[email protected]")), "ad9aac7b9a522354e1ff363a86f389e32cec181b") | ||
}) |