-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set gh-pages
as default branch of new repo created by animint2pages
#138
base: master
Are you sure you want to change the base?
Conversation
The tests for animint2pages all passed on my local. |
owner = owner, | ||
repo = repo_name | ||
) | ||
repo_info$default_branch == "gh-pages" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like a good start. Thanks.
however, I think a better test would be if you clone the repo and test if branch name of the clone is gh-pages ... That test would more directly address the usability concern (user would not have to switch branches) can you please change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! I will do that.
the error that we are getting on github actions is below, do you know why? how to fix?
|
Currently busy for the next few days, but on an initial glance it looks like it may be an access token problem. In that case someone will need to remake it. I wrote briefly about the procedure to do that in our internal documentation about the website:
https://github.com/animint/animint2/blob/master/readme_website.md#refreshing-the-github-access-token
The token expires every so often. GitHub says it’s a security thing. I am not qualified to say whether this is actually an effective security practice or not.
Additional documentation that could be useful:
https://usethis.r-lib.org/articles/git-credentials.html
… On Jul 7, 2024, at 7:47 AM, Toby Dylan Hocking ***@***.***> wrote:
the error that we are getting on github actions is below, do you know why? how to fix?
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-compiler-ghpages.R:26:3'): animint2pages() returns owner/repo string ──
<github_error/http_error_403/rlang_error/error/condition>
Error in `gh::gh("PATCH /repos/{owner}/{repo}", owner = owner, repo = gh_repo_name,
default_branch = "gh-pages")`: GitHub API error (403): Resource not accessible by personal access token
ℹ Read more at <https://docs.github.com/rest/repos/repos#update-a-repository>
Backtrace:
▆
1. └─animint2::animint2pages(viz, github_repo = "animint2pages_test_repo") at test-compiler-ghpages.R:26:3
2. └─animint2:::manage_gh_pages(...)
3. └─gh::gh(...)
4. └─gh:::gh_make_request(req)
5. └─gh:::gh_error(resp, gh_req = x, error_call = error_call)
6. └─cli::cli_abort(...)
7. └─rlang::abort(...)
── Error ('test-compiler-ghpages.R:[53](https://github.com/animint/animint2/actions/runs/9816550931/job/27106887489?pr=138#step:11:54):3'): animint2pages() default branch is gh-pages ──
<GIT_ERROR/libgit2_error/error/condition>
Error in `libgit2::git_clone`: unexpected http status code: 404
Backtrace:
▆
1. ├─gert::git_clone(...) at test-compiler-ghpages.R:53:3
2. └─gert:::raise_libgit2_error(...)
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 7[59](https://github.com/animint/animint2/actions/runs/9816550931/job/27106887489?pr=138#step:11:60) ]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
|
the error does not say anything about expired token. |
The first failed test:The first test Therefore, the failure in the current GH Actions test is likely due to the newly added code for setting the default branch. I believe the issue might be caused by the newly added code (https://github.com/animint/animint2/pull/138/files#diff-6c77230e5f2bdcb3a3c21e98224ada8f337bb04f677ede3b90406a3933087509R132-R138), which directly uses the GitHub API I am trying to use The second failed test:It is probably because the first test failed, so no repo can be fetched through |
Oh, okay. The error mentioned "Resource not accessible by personal access token" and I made a quick assumption. If it's nothing to do with the PAT, that's fine, though it also means that the solution isn't gonna be as simple as refreshing the token. Which is too bad.
…On 7/8/24 6:51 AM, Toby Dylan Hocking ***@***.***> wrote:
the error does not say anything about expired token.
It says 403 (permission denied) and 404 (not found).
—
Reply to this email directly, view it on GitHub
<#138 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXVTEPDR6UM3UDLI6HSD2ATZLJVJTAVCNFSM6AAAAABKBEMUSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJTGY3TINZYGM>.
You are receiving this because you commented.Message ID:
***@***.***>
|
The The second issue, 404 (not found), remains. Still looking into it. |
I see the test repo is created under @tdhock 's personal GH https://github.com/tdhock/animint2pages_test_repo, because of this setting animint2/.github/workflows/tests.yaml Lines 41 to 42 in be99e45
But in above test run, I tried to print the output of
Indicates that the gh action is trying to clone "https://github.com/NULL/animint2pages_test_repo.git", which obviously does not exist. Let me try using credential. |
…anch and cannot be deleted via gert/gh
Hi @tdhock , do you recall how you created this test repo https://github.com/tdhock/animint2pages_test_repo ? Was it pushed from your local machine or via a GitHub Actions?
based on this comment #101 (comment), the animint2pages_test_repo seems has been created before generating the token? |
yes that is right, I created the repo using github web interface, then followed those instructions to create PAT which gives animint/animint2 repo permissions to push to tdhock/animint2pages_test_repo during gh actions testing of animint2pages. |
Why can't we just keep using animint2pages_test_repo, with the same PAT, and just add a new test to make sure that the default branch that we get when we clone it is gh-pages? |
gert::git_clone(url = paste0("https://github.com/", owner, "/a2p_ghp_test.git"), path = local_repo_path) | ||
# Check the default branch after clone | ||
default_branch <- gert::git_branch(repo = local_repo_path) | ||
expect_equal(default_branch, "gh-pages") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this test be added inside the "animint2pages() returns owner/repo string" block above?
Yes we can just use animint2pages_test_repo only. The reason I added a new repo here is just for testing on GH Actions, because animint2pages() function itself cannot change the default branch of an existing GH repo. The test worked on my local, but I wanted to create a new repo with updated animint2pages(), which sets |
@tdhock Could you create a new animint2pages_test_repo using this branch version of |
"Could you create a new animint2pages_test_repo using this branch version of animint2pages?" the issue is that the current PAT only has write access to one repo, which is already created, but we want to test creation of a new repo, right? |
this was implemented in #147 which also required permission to delete repos. |
Resolve #134
After push animint files onto Github remote repo, change the viz repo default branch to
gh-pages
.