From de1032baef01a9502a2ebaebe7cb67ca166895bb Mon Sep 17 00:00:00 2001 From: cansavvy Date: Tue, 12 Mar 2024 08:51:20 -0400 Subject: [PATCH 1/2] jhudsl-robot -> github actions bot --- .github/automatic-issues/set-repo-settings.md | 4 +--- .github/automatic-issues/update-enrollment.md | 2 -- .github/workflows/check-url.yml | 4 ++-- .github/workflows/docker-build.yml | 8 +++---- .github/workflows/docker-test.yml | 8 +++---- .github/workflows/pull_request.yml | 8 +++---- .github/workflows/render-all.yml | 24 +++++++++---------- .github/workflows/send-updates.yml | 6 ++--- .github/workflows/starting-course.yml | 12 +++++----- .github/workflows/test-send-updates.yml | 6 ++--- 10 files changed, 39 insertions(+), 43 deletions(-) diff --git a/.github/automatic-issues/set-repo-settings.md b/.github/automatic-issues/set-repo-settings.md index cb3765664..da404bf74 100644 --- a/.github/automatic-issues/set-repo-settings.md +++ b/.github/automatic-issues/set-repo-settings.md @@ -2,14 +2,12 @@ For more information on these settings see instructions in [Starting a new OTTR course](https://www.ottrproject.org/getting_started.html#starting-a-new-ottr-course). - [ ] This course repository is set to `public`. -- [ ] [Add the `jhudsl-robot` as a collaborator to your repository.](https://www.ottrproject.org/getting_started.html#5_Add_jhudsl-robot_as_a_collaborator). - - [ ] [Github secret `GH_PAT` has been set](https://www.ottrproject.org/getting_started.html#6_Set_up_your_GitHub_personal_access_token) `Name`: `GH_PAT` `value`: A personal access token [following these instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-token). Underneath `Select scopes`, check both `repo` and `workflow`. Then copy the PAT and save as the value. - + - [ ] GitHub pages is turned on - [ ] Go to `Settings` > `Pages`. Underneath `Source`, choose `main` for the branch and select the `docs` folder. Then click `Save`. - [ ] Check `Enforce HTTPS`. diff --git a/.github/automatic-issues/update-enrollment.md b/.github/automatic-issues/update-enrollment.md index a98e219f4..46d64ab78 100644 --- a/.github/automatic-issues/update-enrollment.md +++ b/.github/automatic-issues/update-enrollment.md @@ -5,5 +5,3 @@ We are working on adding more features and smoothing out bugs as we go. If you want to receive updates from the original template to your course template, you will need to enroll this repository to the template updates by adding it to the `sync.yml` file. - [ ] [Follow these instructions](https://www.ottrproject.org/getting_started.html#9_Enroll_your_repository_for_OTTR_updates) to enroll your course repository to receive these updates. - -- [ ] [Ensure that you have followed these instructions](https://www.ottrproject.org/getting_started.html#5_Add_jhudsl-robot_as_a_collaborator) to add the `jhudsl-robot` as a collaborator to your repository. diff --git a/.github/workflows/check-url.yml b/.github/workflows/check-url.yml index e3f264516..a43704989 100644 --- a/.github/workflows/check-url.yml +++ b/.github/workflows/check-url.yml @@ -45,8 +45,8 @@ jobs: - name: Make the branch fresh run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' echo branch doesnt exist git checkout -b preview-spell-error || echo branch exists diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4a1696450..51a83021e 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -22,11 +22,11 @@ jobs: - name: checkout repo uses: actions/checkout@v4 - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' - name: Don't re-test if this is a sync branch run: | diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 01cb3845b..5775f41fd 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -43,11 +43,11 @@ jobs: ${{ inputs.directory }}/Dockerfile ${{ inputs.directory }}/github_package_list.tsv - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' # Set up Docker build - name: Set up Docker Buildx diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 781c439c5..665620cc8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,8 +33,8 @@ jobs: - name: Make the branch fresh run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' branch_name='preview-${{ github.event.pull_request.number }}' echo branch doesnt exist @@ -130,8 +130,8 @@ jobs: - name: Set up git checkout run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' branch_name='preview-${{ github.event.pull_request.number }}' git fetch --all diff --git a/.github/workflows/render-all.yml b/.github/workflows/render-all.yml index 052d7f11c..12643d877 100644 --- a/.github/workflows/render-all.yml +++ b/.github/workflows/render-all.yml @@ -49,11 +49,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' # We want a fresh run of the renders each time - name: Delete old docs/* @@ -101,11 +101,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - - name: Login as jhudsl-robot + - name: Login as github-actions bot run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' # Rendered content for Leanpub and Coursera is very similar. # This job creates a shared scaffold for both. @@ -140,11 +140,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' # Create screenshots - name: Run the screenshot creation @@ -217,11 +217,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - - name: Login as jhudsl-robot + - name: Login as github action run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' # Run Coursera version - name: Convert Leanpub quizzes to Coursera diff --git a/.github/workflows/send-updates.yml b/.github/workflows/send-updates.yml index 07a0cd995..f636dc046 100644 --- a/.github/workflows/send-updates.yml +++ b/.github/workflows/send-updates.yml @@ -20,11 +20,11 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' - name: Get the version id: get_tag diff --git a/.github/workflows/starting-course.yml b/.github/workflows/starting-course.yml index 053c37505..97309b3fd 100644 --- a/.github/workflows/starting-course.yml +++ b/.github/workflows/starting-course.yml @@ -18,12 +18,12 @@ jobs: - name: checkout repo uses: actions/checkout@v4 - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" - + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + ##### Delete Template-specific files that aren't needed for new courses # Cleanup Template-specific bits @@ -60,8 +60,8 @@ jobs: id: commit_it run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' git add . git commit -m "Template cleanup" pushed_it=true diff --git a/.github/workflows/test-send-updates.yml b/.github/workflows/test-send-updates.yml index ffb1afc95..61e6b7133 100644 --- a/.github/workflows/test-send-updates.yml +++ b/.github/workflows/test-send-updates.yml @@ -20,11 +20,11 @@ jobs: - name: Checkout Repository uses: actions/checkout@master - - name: Login as jhudsl-robot + - name: Login as github actions bot run: | git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.email "itcrtrainingnetwork@gmail.com" - git config --global user.name "jhudsl-robot" + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' - name: Set up test-sync.yml run: | From 6685799c45ed5b8e7ad84c3d49f3dd1d9cafdb19 Mon Sep 17 00:00:00 2001 From: Candace Savonen Date: Tue, 12 Mar 2024 09:18:44 -0400 Subject: [PATCH 2/2] update starting course yml --- .github/workflows/starting-course.yml | 47 +++++---------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/.github/workflows/starting-course.yml b/.github/workflows/starting-course.yml index 97309b3fd..76eb3f879 100644 --- a/.github/workflows/starting-course.yml +++ b/.github/workflows/starting-course.yml @@ -4,16 +4,14 @@ name: Starting a new course on: - push: - branches: [ main, staging ] - workflow_dispatch: + create: jobs: - # Run cleaning process only if workflow is triggered by not being in the Bookdown template anymore - template-cleanup: - name: Template Cleanup + first-time-setup: + # ensure run only once, when repo generated + if: github.run_number == 1 + runs-on: ubuntu-latest - if: github.event.repository.name != 'OTTR_Template' steps: - name: checkout repo uses: actions/checkout@v4 @@ -54,39 +52,10 @@ jobs: docs/*.md \ manuscript/* - - # Commit modified files - - name: Commit deleted files - id: commit_it - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add . - git commit -m "Template cleanup" - pushed_it=true - git push || pushed_it=false - echo "pushed_it=$pushed_it" >> $GITHUB_OUTPUT - - # If main is already protected, then file a PR - - name: Create PR with deleted files - if: steps.commit_it.outputs.pushed_it == 'false' - uses: peter-evans/create-pull-request@v3 - id: pr + - name: Commit changed files + uses: stefanzweifel/git-auto-commit-action@v4 with: - commit-message: Delete unnecessary files - signoff: false - branch: auto_copy_rendered_files - delete-branch: true - title: 'Automatic course set up' - body: | - ### Description: - This PR was initiated by the github actions. It helps set up this repository to be ready to write your course. - It deletes some remnant files you don't need for your course but were used when this was a template. - labels: | - automated - reviewers: $GITHUB_ACTOR - token: ${{secrets.GH_PAT}} + commit_message: "Setup repo" ##### Filing issues!