Merge pull request #224 from jhudsl/update-student-stuff #183
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code adapted from https://github.com/JetBrains/intellij-platform-plugin-template/blob/deb171483598ee8a5d7621154db880e87b4db4ef/.github/workflows/template-cleanup.yml | |
# by Candace Savonen for OTTR_Template, and by Katherine Cox for AnVIL_Template | |
name: Starting a new course | |
on: | |
push: | |
branches: [ main, staging ] | |
workflow_dispatch: | |
jobs: | |
# Run cleaning process only if workflow is triggered by not being in the Bookdown template anymore | |
template-cleanup: | |
name: Template Cleanup | |
runs-on: ubuntu-latest | |
if: github.event.repository.name != 'AnVIL_Template' | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v3 | |
- name: Login as jhudsl-robot | |
run: | | |
git config --global --add safe.directory $GITHUB_WORKSPACE | |
git config --global user.email "[email protected]" | |
git config --global user.name "jhudsl-robot" | |
##### Delete Template-specific files that aren't needed for new courses | |
# Cleanup Template-specific bits | |
- name: Cleanup | |
run: | | |
# Cleanup | |
rm -rf \ | |
.github/workflows/send-updates.yml \ | |
.github/workflows/test-send-updates.yml \ | |
.github/workflows/starting-course.yml \ | |
.github/workflows/release-notes.yml \ | |
.github/sync.yml \ | |
.github/switch_sync_repo.yml \ | |
child/* \ | |
resources/code_output \ | |
resources/screenshots \ | |
resources/course_screenshots \ | |
resources/gs_slides \ | |
resources/image_to_slide_key.tsv \ | |
resources/images/02-chapter_of_course_files \ | |
resources/images/03-test_cases_files \ | |
resources/images/04-figures_files \ | |
resources/chapt_screen_images \ | |
Course_Name.rds \ | |
docs/*.html \ | |
docs/*.md \ | |
manuscript/* | |
# Commit modified files | |
- name: Commit deleted files | |
id: commit_it | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Template cleanup" | |
pushed_it=true | |
git push || pushed_it=false | |
echo ::set-output name=pushed_it::$pushed_it | |
# 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 | |
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 | |
##### Filing issues! | |
# Issue for what repository settings need to be set | |
- name: New Course - Set Repository Settings | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: New Course - Set Repository Settings | |
content-filepath: .github/automatic-issues/set-repo-settings.md | |
labels: automated training issue | |
# Issue for what needs to be edited | |
- name: New Course - Templates to Edit | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: New Course - Templates to Edit | |
content-filepath: .github/automatic-issues/templates-to-edit.md | |
labels: automated training issue | |
# Issue for how to enroll repo for updates | |
- name: New Course - Template Update Enrollment | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: New Course - Template Update Enrollment | |
content-filepath: .github/automatic-issues/update-enrollment.md | |
labels: automated training issue | |
# Issue for adding a method of feedback | |
- name: Reminder - Add a method of user feedback | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: Reminder - Add user feedback method | |
content-filepath: .github/automatic-issues/add-feedback-method.md | |
labels: automated training issue | |
- name: Get organization name | |
id: get_org_name | |
run: | | |
org_name=$(dirname ${{github.repository}}) | |
echo ::set-output name=org_name::$org_name | |
echo $org_name | |
# Issue for reminding people to tag their repo to ensure it gets added to the ANIVL Collection | |
- name: New Course - Add Repo to AnVIL Collection | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: New Course - Add Repo to AnVIL Collection | |
content-filepath: .github/automatic-issues/add-repo-to-anvil-collection.md | |
labels: automated training issue | |