Skip to content

Commit 25dc5a5

Browse files
author
jhudsl-robot
committed
🔄 Synced local '.github/workflows/' with remote '.github/workflows/'
release-renderAction
1 parent 8ea235e commit 25dc5a5

File tree

4 files changed

+272
-233
lines changed

4 files changed

+272
-233
lines changed

.github/workflows/check-url-2.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Periodic URL Check 2
2+
3+
4+
on:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 0 1 * *'
8+
9+
jobs:
10+
set-up:
11+
name: Load user automation choices
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
# Use the yaml-env-action action.
20+
- name: Load environment from YAML
21+
uses: doughepi/yaml-env-action@v1.0.0
22+
with:
23+
files: config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence.
24+
outputs:
25+
toggle_url_check_periodically: "${{ env.URL_CHECK_PERIODICALLY }}"
26+
27+
url-check:
28+
name: Check URLs
29+
needs: set-up
30+
if: ${{needs.set-up.outputs.toggle_url_check_periodically == 'true'}}
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0
38+
39+
# Delete the branch if this has been run before
40+
- name: Delete branch locally and remotely
41+
run: git push origin --delete preview-spell-error || echo "No branch to delete"
42+
43+
# Make the branch fresh
44+
- name: Make the branch fresh
45+
run: |
46+
git config --global --add safe.directory $GITHUB_WORKSPACE
47+
git config --global user.name 'github-actions[bot]'
48+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
49+
50+
echo branch doesnt exist
51+
git checkout -b preview-spell-error || echo branch exists
52+
git push --set-upstream origin preview-spell-error || echo echo branch exists remotely
53+
shell: bash
54+
55+
- name: Run the check
56+
uses: ottrproject/ottr-reports@main
57+
id: check_results
58+
continue-on-error: true
59+
with:
60+
check_spelling: false
61+
spelling_error_min: 1
62+
check_urls: true
63+
url_error_min: 1
64+
check_quiz_form: false
65+
quiz_error_min: 1
66+
sort_dictionary: false
67+
68+
- name: Declare file path and time
69+
id: check-report
70+
run: |
71+
error_num=$(cat check_reports/url_checks.tsv | wc -l)
72+
error_num="$((error_num-1))"
73+
echo "error_num=$error_num" >> $GITHUB_OUTPUT
74+
echo "error_url=https://github.com/${GITHUB_REPOSITORY}/blob/preview-spell-error/check_reports/url_checks.tsv" >> $GITHUB_OUTPUT
75+
shell: bash
76+
77+
- name: Stop if failure
78+
if: steps.check_results.outcome == 'failure'
79+
run: exit 1
80+
81+
- name: Print out error variables
82+
run: |
83+
echo ${{ steps.check-report.outputs.error_url }}
84+
echo ${{ steps.check-report.outputs.error_num }}
85+
86+
# Commit file
87+
- name: Commit tocless bookdown files
88+
if: ${{ steps.check-report.outputs.error_num >= 1 }}
89+
env:
90+
GH_PAT: ${{ secrets.GH_PAT }}
91+
run: |
92+
git add --force check_reports/url_checks.tsv
93+
git commit -m 'Add spell check file' || echo "No changes to commit"
94+
git push --set-upstream origin preview-spell-error || echo echo branch exists remotely
95+
96+
- name: Find issues
97+
id: find-issue
98+
env:
99+
GH_PAT: ${{ secrets.GH_PAT }}
100+
run: |
101+
echo "$GITHUB_REPOSITORY"
102+
curl -o find_issue.R https://raw.githubusercontent.com/ottrproject/ottr-reports/main/scripts/find_issue.R
103+
issue_exists=$(Rscript --vanilla find_issue.R --repo $GITHUB_REPOSITORY --git_pat $GH_PAT)
104+
echo URL issue exists: $issue_exists
105+
echo "issue_existence=$issue_exists" >> $GITHUB_OUTPUT
106+
107+
- name: If too many URL errors, then make an issue
108+
if: ${{ steps.check-report.outputs.error_num >= 1 && steps.find-issue.outputs.issue_existence == 0}}
109+
uses: JasonEtco/create-an-issue@v2
110+
with:
111+
filename: .github/ISSUE_TEMPLATE/url-error.md
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
FILE_URL: ${{ steps.check-report.outputs.error_url }}
115+
ERROR_NUM: ${{ steps.check-report.outputs.error_num }}
116+
117+
- name: If no URL errors than delete the branch we made
118+
if: ${{ steps.check-report.outputs.error_num < 1 }}
119+
run: |
120+
git config --system --add safe.directory "$GITHUB_WORKSPACE"
121+
git push origin --delete preview-spell-error || echo "No branch to delete"

.github/workflows/check-url.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
url-check:
2727
name: Check URLs
2828
needs: set-up
29-
if: ${{needs.set-up.outputs.toggle_url_check_periodically == 'yes'}}
29+
if: ${{needs.set-up.outputs.toggle_url_check_periodically == 'true'}}
3030
runs-on: ubuntu-latest
3131
container:
3232
image: jhudsl/base_ottr:main
@@ -54,12 +54,17 @@ jobs:
5454
shell: bash
5555

5656
- name: Run the check
57-
uses: jhudsl/ottr-reports@main
57+
uses: ottrproject/ottr-reports@main
5858
id: check_results
5959
continue-on-error: true
6060
with:
61-
check_type: urls
62-
error_min: 1
61+
check_spelling: false
62+
spelling_error_min: 1
63+
check_urls: true
64+
url_error_min: 1
65+
check_quiz_form: false
66+
quiz_error_min: 1
67+
sort_dictionary: false
6368

6469
- name: Declare file path and time
6570
id: check-report
@@ -79,13 +84,23 @@ jobs:
7984
echo ${{ steps.check-report.outputs.error_url }}
8085
echo ${{ steps.check-report.outputs.error_num }}
8186
87+
# Commit file
88+
- name: Commit tocless bookdown files
89+
if: ${{ steps.check-report.outputs.error_num >= 1 }}
90+
env:
91+
GH_PAT: ${{ secrets.GH_PAT }}
92+
run: |
93+
git add --force check_reports/url_checks.tsv
94+
git commit -m 'Add spell check file' || echo "No changes to commit"
95+
git push --set-upstream origin preview-spell-error || echo echo branch exists remotely
96+
8297
- name: Find issues
8398
id: find-issue
8499
env:
85100
GH_PAT: ${{ secrets.GH_PAT }}
86101
run: |
87102
echo "$GITHUB_REPOSITORY"
88-
curl -o find_issue.R https://raw.githubusercontent.com/jhudsl/ottr-reports/main/scripts/find_issue.R
103+
curl -o find_issue.R https://raw.githubusercontent.com/ottrproject/ottr-reports/main/scripts/find_issue.R
89104
issue_exists=$(Rscript --vanilla find_issue.R --repo $GITHUB_REPOSITORY --git_pat $GH_PAT)
90105
echo URL issue exists: $issue_exists
91106
echo "issue_existence=$issue_exists" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)