diff --git a/.github/workflows/make_update_prs.yml b/.github/workflows/make_update_prs.yml new file mode 100644 index 00000000..605e90a0 --- /dev/null +++ b/.github/workflows/make_update_prs.yml @@ -0,0 +1,112 @@ +name: Update Member Pages + +on: + schedule: + - cron: '0 0 30 6,12 *' # Every June 30 and December 30 at midnight UTC + workflow_dispatch: + +jobs: + update-pages: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install PyGithub python-dateutil + + - name: Run update script + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + run: | + python < code` button above, copying the URL to your clipboard, and then executing `git clone link` in the terminal in which you paste the link in place of the word `link` in your desired local directory. 2. In the terminal, travel to the website directory. Remain there for the rest of the instructions. Create a new branch by executing `git checkout -b your_name_branch` in the terminal. -3. Add your name to `members.txt` (by running `nano members.txt` in the terminal) under the appropriate category in alphabetic order by last name. Type your name _exactly_ how you would like it to show up in the directory. +3. Add your name to `members.txt` (by running `nano members.txt` in the terminal) under the appropriate category in alphabetic order by last name. Type your name _exactly_ how you would like it to show up in the directory, followed by a dash ' - ' and your GitHub username. 4. Execute `cp members/example_student.md members/your_name.md` in terminal where `your_name` is the name you wrote in (3), but lowercase and with '_' instead of spaces. This will create a file `members/your_name.md` that is an exact copy of `members/example_student.md`. 5. Fill out `members/your_name.md`! Access the file by executing `nano members/your_name.md` and make sure to replace all instances of `example student` with your name. 6. Add a professional photo (preferably square aspect ratio) at `assets/img/your_name.png`. This can be done manually on the cumputer desktop or by executing `cp /path/to/source/your_name.png ./assets/img`, where `/path/to/source` is the path to where the image is on your computer. diff --git a/make_member_page.py b/make_member_page.py index 30812fc4..2bf9e214 100755 --- a/make_member_page.py +++ b/make_member_page.py @@ -1,20 +1,23 @@ +import re import os with open("members/index.md", "w") as outf: outf.write("---\nlayout: default\n---\n# Cersonsky Lab Members\n\n") - outf.write("\n\n\n\n") + outf.write( + "\n\n\n\n" + ) n = 0 subtitle = "" @@ -38,21 +41,15 @@ for j in range(len(peeps)): if j < len(peeps): ext = "png" - if not os.path.exists( - f"assets/img/{peepcodes[j]}.png" - ): - if not os.path.exists( - f"assets/img/{peepcodes[j]}.jpg" - ): + if not os.path.exists(f"assets/img/{peepcodes[j]}.png"): + if not os.path.exists(f"assets/img/{peepcodes[j]}.jpg"): raise FileNotFoundError( f"File assets/img/{peepcodes[j]}.png does not exist." ) else: ext = "jpg" - if not os.path.exists( - f"./members/{peepcodes[j]}.md" - ): + if not os.path.exists(f"./members/{peepcodes[j]}.md"): raise FileNotFoundError( f"./members/{peepcodes[j]}.md does not exist." ) @@ -64,9 +61,7 @@ subtitle = line peeps = [] peepcodes = [] - elif line in [ - "end\n" - ]: + elif line in ["end\n"]: if n > 0: s = f'\n\n

{subtitle.title()}

\n\n' skip = n @@ -75,7 +70,7 @@ images = "" for j in range(len(peeps)): if j < len(peeps): - images += f'\t
  • {peeps[j]}
  • \n' + images += f"\t
  • {peeps[j]}
  • \n" images += "\n\n" outf.write(images) outf.write("\n\n------\n") @@ -84,7 +79,15 @@ peeps = [] peepcodes = [] elif line != "\n": - line = line.strip("\n").strip(" - ") - peeps.append(line) - peepcodes.append(line.lower().replace(" ", "_")) - n += 1 + line = line.strip('\n') + while line[0] in ['-',' ']: + line = line[1:] + if ' - ' in line: + line = line[:line.index(' - ')] + while line[-1] in ['-',' ']: + line = line[:-1] + + if len(line) > 0: + peeps.append(line) + peepcodes.append(line.lower().replace(" ", "_")) + n += 1 diff --git a/members.txt b/members.txt index c290013c..04b168ee 100644 --- a/members.txt +++ b/members.txt @@ -1,23 +1,23 @@ principal investigator -Rose (Rosy) Cersonsky +Rose (Rosy) Cersonsky - rosecers postdoctoral researchers graduate researchers - - Charles Carroll - - Ethan Deutsch - - Christian Jorgensen - - Hwigwang Lim - - Arthur Lin + - Charles Carroll - cbefan + - Ethan Deutsch - e-deutsch + - Christian Jorgensen - cajchristian + - Hwigwang Lim - hwigwanglim + - Arthur Lin - arthur-lin1027 undergraduate researchers - - Zachary Amsterdam - - Simon Hjaltason - - Natalie Hooven - - Lucas Ortengren - - Matthew Reuteman - - Rhushil Vasavada - - Caleb Youngwerth + - Zachary Amsterdam - zamsterdam + - Simon Hjaltason - simon-hjaltason + - Natalie Hooven - nat-hooven + - Lucas Ortengren - ortengren + - Matthew Reuteman - Matthew-Reuteman + - Rhushil Vasavada - rvasav26 + - Caleb Youngwerth - cjyoungwerth visitors and collaborators - Lisa Je