Skip to content

Commit

Permalink
mysterious error
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy committed Feb 29, 2024
1 parent 3093c4c commit 526c917
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/check-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,10 @@ jobs:
echo "$GITHUB_REPOSITORY"
issue_exists=$(Rscript --vanilla scripts/find_issue.R --repo $GITHUB_REPOSITORY --git_pat $GH_PAT)
echo URL issue exists: $issue_exists
echo "issue_exists=$issue_exists" >> $GITHUB_OUTPUT
# We want to retrieve this file after this runs so we can see what spell check errors were detected
- name: Archive session info
uses: actions/upload-artifact@v3
# These arguments underneath `with` are generally action specific so we have to check the documentation: https://github.com/marketplace/actions/upload-a-build-artifact
with:
name: session_info.txt
path: session_info.txt
echo "issue_existence=$issue_exists" >> $GITHUB_OUTPUT
- name: If too many URL errors, then make an issue
if: ${{ steps.check-report.outputs.error_num >= 1 && steps.find-issue.outputs.issue_exists == true}}
if: ${{ steps.check-report.outputs.error_num >= 1 && steps.find-issue.outputs.issue_existence >= 1}}
uses: JasonEtco/create-an-issue@v2
with:
filename: .github/ISSUE_TEMPLATE/url-error.md
Expand Down
10 changes: 5 additions & 5 deletions scripts/find_issue.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ if (!is.character(repo)) {

install.packages('gh', repos='http://cran.us.r-project.org')

my_issues <- gh::gh("GET https://api.github.com/repos/{repo}/issues",
repo = repo,
.token = git_pat,
per_page = 100)
my_issues <- gh::gh("GET https://api.github.com/repos/{repo}/issues",
repo = repo,
.token = git_pat)

my_issues <- unlist(my_issues)
issue_titles <- my_issues[which(names(my_issues) == "title")]

issue_exists <- any(grep('Broken URLs found in the course!', issue_titles))

# Print out the result
write(as.character(issue_exists), stdout())
write(length(issue_exists), stdout())

0 comments on commit 526c917

Please sign in to comment.