Skip to content
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

Figuring out better system for downloading spell check file #386

Merged
merged 34 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
000dbb2
Save to file
cansavvy Jan 13, 2022
484ff3b
No $()
cansavvy Jan 13, 2022
8f07ee8
Reconfig the url
cansavvy Jan 13, 2022
ccc5fba
Use correct env variable
cansavvy Jan 13, 2022
ac6a50e
Try to put the file on the preview branch
cansavvy Jan 13, 2022
2e5cfe0
syntax error fix
cansavvy Jan 13, 2022
e503c83
another syntax error
cansavvy Jan 13, 2022
6325bf9
Merge branch 'main' into cansavvy/jhudsl-robot
jhudsl-robot Jan 13, 2022
a33104c
Add spell check results
cansavvy Jan 13, 2022
63ec1a5
Merge remote-tracking branch 'origin/cansavvy/jhudsl-robot' into cans…
cansavvy Jan 13, 2022
fe6c0e4
wrong branch
cansavvy Jan 13, 2022
c885ebd
Old piece left
cansavvy Jan 13, 2022
c3f09a6
Fix wrangling
cansavvy Jan 13, 2022
6afb680
Merge c3f09a6f961847a65284fbff99a524b2b23191de into f1259c0ceedafbb5e…
cansavvy Jan 13, 2022
d119faf
Render bookdown preview
actions-user Jan 13, 2022
7cd4c3b
set upstream
cansavvy Jan 13, 2022
b5571e9
Clear out docs files
cansavvy Jan 13, 2022
d8aa40b
Try a merge
cansavvy Jan 13, 2022
bf9839a
Will this work?
cansavvy Jan 13, 2022
76b3a22
git pull
cansavvy Jan 13, 2022
67a7d90
Set up tracking
cansavvy Jan 13, 2022
6c84bfc
change up pull step
cansavvy Jan 13, 2022
3258861
force push it
cansavvy Jan 13, 2022
f93c9da
Merge branch 'preview-386' of https://github.com/jhudsl/OTTR_Template…
cansavvy Jan 13, 2022
91db4de
Try this --set-upstream bit
cansavvy Jan 13, 2022
f16c1d7
Force push
cansavvy Jan 13, 2022
637e02a
allow unrelated histories
cansavvy Jan 13, 2022
688a8c0
Minor annotation update
cansavvy Jan 13, 2022
b962f8a
fix if statement
cansavvy Jan 13, 2022
093f41c
Put another if
cansavvy Jan 13, 2022
0ab1d43
Try pulling stuff
cansavvy Jan 13, 2022
5969efe
Try to fix render preview
cansavvy Jan 13, 2022
40fa426
try to remerge instead
cansavvy Jan 13, 2022
0caa1bb
add to dictionary so it passes
cansavvy Jan 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/render-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout
- name: Checkout files
uses: actions/checkout@v2

# We want a fresh run of the renders each time
- name: Delete old docs/*
run: |
rm -r docs/*

# Set up git checkout
- name: Set up git checkout
run: |
git checkout -b "preview-${{ github.event.pull_request.number }}"
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git config --local user.email "itcrtrainingnetwork@gmail.com"
git config --local user.name "jhudsl-robot"
git config pull.rebase false

# Get on the preview branch if it exists. If it doesn't create it.
branch_name='preview-${{ github.event.pull_request.number }}'
git rev-parse --quiet --verify $branch_name >/dev/null && exists=true || exists=false

if [[ $exists == true ]];
then
git checkout $branch_name
git pull --set-upstream origin $branch_name --allow-unrelated-histories
else
git checkout -b $branch_name
fi

rm -r docs/*

# Run bookdown rendering
- name: Run bookdown render
Expand Down Expand Up @@ -63,7 +72,7 @@ jobs:
exit 1

# Commit the rendered bookdown files
- name: Commit rendered bookdown files to development branch
- name: Commit rendered bookdown files to preview branch
id: commit
run: |
changes=$(git diff --name-only `git log --format="%H" -n 1 origin/main` -- docs)
Expand All @@ -72,7 +81,8 @@ jobs:
echo ::set-output name=changes::$(echo 'changes')
git add . --force
git commit -m 'Render bookdown preview'
git push --force origin "preview-${{ github.event.pull_request.number }}"
git pull --set-upstream origin "preview-${{ github.event.pull_request.number }}" --allow-unrelated-histories
git push --force --set-upstream origin "preview-${{ github.event.pull_request.number }}"
else
echo ::set-output name=changes::$(echo 'no_changes')
fi
Expand Down
31 changes: 26 additions & 5 deletions .github/workflows/style-and-sp-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: checkout repo
- name: Checkout files
uses: actions/checkout@v2

- name: login as jhudsl-robot
Expand All @@ -33,22 +33,42 @@ jobs:
run: |
results=$(Rscript "scripts/spell-check.R")
echo "::set-output name=sp_chk_results::$results"
cat spell_check_results.tsv
cat resources/spell_check_results.tsv

- name: Archive spelling errors
uses: actions/upload-artifact@v2
with:
name: spell-check-results
path: spell_check_results.tsv
path: resources/spell_check_results.tsv

- name: Spell check errors
run: |
# Get on the preview branch if it exists. If it doesn't create it.
branch_name='preview-${{ github.event.pull_request.number }}'
git rev-parse --quiet --verify $branch_name >/dev/null && exists=true || exists=false

if [[ $exists == true ]];
then
git checkout $branch_name
git pull --set-upstream origin $branch_name --allow-unrelated-histories
else
git checkout -b $branch_name
fi

git add --force resources/spell_check_results.tsv
git commit -m 'Add spell check file'
git push --force --set-upstream origin $branch_name

- name: Build components of the spell check comment
id: build-components
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
branch_name='preview-${{ github.event.pull_request.number }}'
sp_error_url=https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/$branch_name/resources/spell_check_results.tsv
echo ::set-output name=time::$(date +'%Y-%m-%d')
echo ::set-output name=commit_id::$GITHUB_SHA
echo ::set-output name=sp_error_url::$(Rscript --vanilla scripts/get_spell_errors.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT")
echo ::set-output name=sp_error_url::$sp_error_url

# Handle the commenting
- name: Find Comment
Expand Down Expand Up @@ -91,8 +111,9 @@ jobs:
- name: Run styler
run: Rscript -e "styler::style_file(list.files(pattern = 'Rmd$', recursive = TRUE, full.names = TRUE));warnings()"

- name: Commit
- name: Commit styled files
run: |
git add \*.Rmd
git add resources/spell_check_results.tsv
git commit -m 'Style Rmds' || echo "No changes to commit"
git push origin || echo "No changes to commit"
2 changes: 1 addition & 1 deletion docs/About.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ These credits are based on our [course contributors table guidelines](https://gi
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2022-01-06
## date 2022-01-13
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date lib source
Expand Down
Binary file modified docs/Course_Name.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/about-the-authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ <h1>About the Authors</h1>
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2022-01-06
## date 2022-01-13
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date lib source
Expand Down
2 changes: 1 addition & 1 deletion docs/coursera/About.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ These credits are based on our [course contributors table guidelines](https://gi
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2022-01-06
## date 2022-01-13
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date lib source
Expand Down
2 changes: 1 addition & 1 deletion docs/coursera/about-the-authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ <h1>About the Authors</h1>
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2022-01-06
## date 2022-01-13
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date lib source
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/coursera/search_index.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/search_index.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions resources/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ BIPOC
Bloomberg
Datatrail
DataTrail
dropdown
GDSCN
impactful
ITCR
itcrtraining
ITN
fyi
Leanpub
Markua
mentorship
NCI
NHGRI
UE
UE5
reproducibility
underserved
www
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion scripts/spell-check.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ sp_errors <- spelling::spell_check_files(files, ignore = dictionary) %>%
# Print out how many spell check errors
write(nrow(sp_errors), stdout())

if (!dir.exists("resources")) {
dir.create("resources")
}

# Save spell errors to file temporarily
readr::write_tsv(sp_errors, 'spell_check_results.tsv')
readr::write_tsv(sp_errors, file.path('resources', 'spell_check_results.tsv'))