jhudsl / OTTR_Template

OTTR for making courses! This is a template repo that helps people write 1 course but publish it in three places
https://www.ottrproject.org/
Creative Commons Attribution 4.0 International
17 stars 14 forks source link

Have URLs periodically checked #673

Closed cansavvy closed 8 months ago

cansavvy commented 1 year ago

Purpose/implementation Section

What changes are being implemented in this Pull Request?

This is a start to having a GHA that will check URLs periodically on a course without being provoked.

A few things we have to develop here:

  1. We probably want it to make an issue if there's a URL error found.
  2. If no error is found, we want it to clean up the preview branch and everything it does.

The last bit I have to put in here is if an issue is already open for broken URLs, we don't want to create another one. There doesn't seem to be a convenient GitHub Action for this, so I'm going to have to write a GitHub API accessing script to do it myself. I'll add it to the github-helpers or cow package.

I tried https://github.com/nickderobertis/check-if-issue-exists-action and https://actions-cool.github.io/issues-helper/advanced#find-issues but both assume the GitHub Action you are running is being triggered by an issue based trigger which is not what is happening for us.

github-actions[bot] commented 1 year ago

Re-rendered previews from the latest commit:

Updated at 2024-02-29 with changes from 864246568516325df56fde81a2084dd1bcdfbeff

github-actions[bot] commented 1 year ago

No spelling errors! :tada: Comment updated at 2024-02-29 with changes from 864246568516325df56fde81a2084dd1bcdfbeff

github-actions[bot] commented 1 year ago

:warning: broken urls :warning: There are broken urls that need to be addressed. Click here :arrow_right: for broken urls errors! :exclamation: Add errors that aren't errors to the resources/ignore-urls.txt file of this repo. If you are having troubles see this guide Comment updated at 2024-02-29 with changes from 864246568516325df56fde81a2084dd1bcdfbeff

cansavvy commented 1 year ago

All that's left here is to test if this works after my new package, githubr is added to CRAN. Which it is on its way.

If it works then I will see if this successfully makes an issue if there's a broken URL.

If it does, then I can delete the pull_request: trigger and then merge this.

cansavvy commented 1 year ago

@howardbaek I'm a bit stumped on why the GitHub API call isn't working here. It works locally. The only difference I can think of is the GitHub PAT.

cansavvy commented 1 year ago

@howardbaek Here's the GHA error I am not sure. It works locally for me but not here. Not sure what the difference is. Let me know if you have ideas. The specific error is:

Error in gh_process_response(raw) : 
GitHub API error (404): 
Message: Not Found
Read more at https://docs.github.com/rest/repos/repos#get-a-repository

URL not found: https://api.github.com/repos/%7Brepo%7D/issues?repo=jhudsl%2FOTTR_Template&per_page=100
Calls: <Anonymous> ... <Anonymous> -> gh_process_response -> gh_error -> throw
Execution halted

It smells like an authentication error but its not an auth error I've been able to reproduce locally.