diff --git a/active_all_call.tex b/active_all_call.tex index 1521247..8707bb7 100644 --- a/active_all_call.tex +++ b/active_all_call.tex @@ -1,3 +1,5 @@ +\item Radio Telemetry Tracker \item Mangrove Monitoring +\item FishSense +\item Baboons on the Move \item Acoustic Species ID -\item Baboons on the Move \ No newline at end of file diff --git a/active_order.tex b/active_order.tex index c60ccb1..e118357 100644 --- a/active_order.tex +++ b/active_order.tex @@ -1,3 +1,2 @@ -\item Fishsense -\item Radio Telemetry Tracker -\item Smartfin \ No newline at end of file +\item Smartfin +\item Hardware Development Group diff --git a/active_sections.tex b/active_sections.tex index b01ca3f..7c820e3 100644 --- a/active_sections.tex +++ b/active_sections.tex @@ -1,6 +1,4 @@ -\section{Fishsense} -\include{project_fs} -\section{Radio Telemetry Tracker} -\include{project_rtt} \section{Smartfin} -\include{project_sf} \ No newline at end of file +\include{project_sf} +\section{Hardware Development Group} +\include{project_hw} diff --git a/config.yml b/config.yml index bc55269..54fbfcf 100644 --- a/config.yml +++ b/config.yml @@ -46,12 +46,12 @@ projects: - ntlhui schedule: # Keyed by ISO Week Number of presentation - 2: [smartfin, hardware] - 3: [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 2 - 4: [fishsense, radio_telemetry_tracker, smartfin] # WI24 3 - 5: [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 4 - 6: [fishsense, radio_telemetry_tracker, smartfin] # WI24 5 - 7: [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 6 - 8: [fishsense, radio_telemetry_tracker, smartfin] # WI24 7 - 9: [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 8 - 10: [fishsense, radio_telemetry_tracker, smartfin] # WI24 9 \ No newline at end of file + '2024-01-10': [smartfin, hardware] + '2024-01-17': [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 2 + '2024-01-24': [fishsense, radio_telemetry_tracker, smartfin] # WI24 3 + '2024-01-31': [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 4 + '2024-02-07': [fishsense, radio_telemetry_tracker, smartfin] # WI24 5 + '2024-02-14': [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 6 + '2024-02-21': [fishsense, radio_telemetry_tracker, smartfin] # WI24 7 + '2024-02-28': [mangrove_monitoring, acoustic_species_id, baboons_on_the_move] # WI24 8 + '2024-03-06': [fishsense, radio_telemetry_tracker, smartfin] # WI24 9 \ No newline at end of file diff --git a/configure_presentation.py b/configure_presentation.py index 8498ad3..76fd0e7 100644 --- a/configure_presentation.py +++ b/configure_presentation.py @@ -1,8 +1,10 @@ ''' Presentation Configuration ''' import datetime as dt +import os +import shlex import subprocess -from typing import Dict, List, Set, Tuple +from typing import Dict, List, Sequence, Set import pytz import schema @@ -19,7 +21,7 @@ } }, 'schedule': { - int: [str] + str: [str] } } ) @@ -30,8 +32,6 @@ def main(): """ timezone = pytz.timezone('America/Los_Angeles') exec_timestamp = dt.datetime.now(timezone) - calendar_tuple = exec_timestamp.isocalendar() - next_weeknum = calendar_tuple[1] + 1 # Read schedule from schedule.yml with open('config.yml', 'r', encoding='utf-8') as handle: @@ -39,20 +39,32 @@ def main(): config = config_schema.validate(data) # allow assert - we want the action to fail if the current week is not supported - schedule = config['schedule'] - assert next_weeknum in schedule - - current_projects: List[str] = schedule[next_weeknum] + raw_schedule: Dict[str, List[str]] = config['schedule'] + full_schedule = {dt.date.fromisoformat( + key): value for key, value in raw_schedule.items()} + future_schedule = {date: sequence + for date, sequence in full_schedule.items() + if date > exec_timestamp.date()} + assert len(future_schedule) > 0 + next_date = min(future_schedule.keys()) + + current_projects: List[str] = future_schedule[next_date] print(current_projects) projects: Dict = config['projects'] all_call_projects: Set[str] = set( projects.keys()).difference(current_projects) print(all_call_projects) + _exec_cmd( + ['git', 'config', 'user.email', 'e4e@ucsd.edu'] + ) + _exec_cmd( + ['git', 'config', 'user.name', 'E4E GitHub Actions'] + ) __update_latex(current_projects, projects, all_call_projects) # Create the appropriate branches - __create_branches(current_projects, projects, calendar_tuple) + __create_branches(current_projects, projects, next_date) def __update_latex(current_projects: List[str], projects: Dict, all_call_projects: Set[str]): @@ -69,38 +81,50 @@ def __update_latex(current_projects: List[str], projects: Dict, all_call_project handle.write(f'\\section{{{projects[project]["name"]}}}\n') handle.write(f'\\include{{{projects[project]["latex"]}}}\n') + _exec_cmd( + [ + 'git', 'add', + 'active_all_call.tex', + 'active_order.tex', + 'active_sections.tex' + ] + ) + _exec_cmd([ + 'git', 'commit', + '-m', f'feat!: Configures presentation for {", ".join(current_projects)}' + ]) + _exec_cmd([ + 'git', 'push' + ]) + def __create_branches(current_projects: List[str], projects: Dict, - calendar_tuple: Tuple): - current_year = calendar_tuple[0] - next_weeknum = calendar_tuple[1] + 1 - subprocess.check_call( - ['git', 'config', 'user.email', 'e4e@ucsd.edu'] - ) - subprocess.check_call( - ['git', 'config', 'user.name', 'E4E GitHub Actions'] - ) + presentation_date: dt.date): + for project in current_projects: project_params = projects[project] - branch_name = f'{project_params["branch"]}_{current_year}_{next_weeknum}' - subprocess.check_call( + branch_name = f'{project_params["branch"]}_{presentation_date.isoformat()}' + _exec_cmd( + ['git', 'checkout', 'main'] + ) + _exec_cmd( ['git', 'checkout', '-b', branch_name] ) # Reset the slides with open('base_project.tex', 'r', encoding='utf-8') as reference_handle, \ open(project_params['latex'] + '.tex', 'w', encoding='utf-8') as target_handle: target_handle.write( - f'% Slides for {current_year} Week {next_weeknum}\n') + f'% Slides for {presentation_date.isoformat()}\n') for line in reference_handle: target_handle.write(line) - subprocess.check_call( + _exec_cmd( ['git', 'add', project_params['latex'] + '.tex'] ) - subprocess.check_call( + _exec_cmd( ['git', 'commit', '-m', 'fix: Resetting slides'] ) - subprocess.check_call( + _exec_cmd( ['git', 'push', '--set-upstream', 'origin', branch_name] ) command = [ @@ -109,14 +133,25 @@ def __create_branches(current_projects: List[str], '-t', project_params['name'], '-d', '-H', branch_name, - '-b', f'Weekly presentation slides for {project_params["name"]}' + '-b', (f'Weekly presentation slides for {project_params["name"]} for ' + f'{presentation_date.isoformat()}') ] for assignee in project_params['assignees']: command.extend(('-a', assignee)) - subprocess.check_call( + _exec_cmd( command ) +def _exec_cmd(cmd: Sequence[str]): + # only exec if GH_TOKEN is defined, i.e. in GitHub Actions + if 'GH_TOKEN' in os.environ: + subprocess.check_call( + args=cmd + ) + else: + print(shlex.join(cmd)) + + if __name__ == '__main__': main() diff --git a/project_hw.tex b/project_hw.tex new file mode 100644 index 0000000..ff408ae --- /dev/null +++ b/project_hw.tex @@ -0,0 +1,41 @@ +% Slides for 2024-01-10 +% To create a slide, use the following: +% \begin{frame}{TITLE} +% BODY +% \end{frame} + +% To create a slide with a bullet list, use the following: +% \begin{frame}{TITLE} +% \begin{itemize} +% \item ITEM 1 +% \item ITEM 2 +% \end{itemize} +% \end{frame} + +% To create a slide with numbered list, use the following: +% \begin{frame}{TITLE} +% \begin{enumerate} +% \item ITEM 1 +% \item ITEM 2 +% \end{enumerate} +% \end{frame} + +% To create a slide with a graphic: +% 1. Add the graphic to this folder (named picture.png) +% 2. Use the following: +% \begin{frame}{TITLE} +% \centering +% \includegraphics[height=0.7\textheight,width=0.7\textwidth,keepaspectratio]{picture.png} +% \end{frame} + +% To create a slide with two columns, use the following: +% \begin{frame}{TITLE} +% \begin{columns} +% \begin{column}{0.5\textwidth} +% COLUMN 1 BODY +% \end{column} +% \begin{column}{0.5\textwidth} +% COLUMN 2 BODY +% \end{column} +% \end{columns} +% \end{frame} diff --git a/project_sf.tex b/project_sf.tex index 1aed8f0..ff408ae 100644 --- a/project_sf.tex +++ b/project_sf.tex @@ -1,4 +1,4 @@ -% Slides for 2024 Week 2 +% Slides for 2024-01-10 % To create a slide, use the following: % \begin{frame}{TITLE} % BODY