From 3f2d6e00aad612adea9462fe88ac20538f3ac311 Mon Sep 17 00:00:00 2001 From: ekmpa Date: Mon, 12 Oct 2026 10:38:55 -0400 Subject: [PATCH] Merge the add-member and update-member forms into one One "Add or update member profile" form: if the name already exists, only the fields filled in are updated; if it's new, a profile is created (Current Role Type and Title are then required, otherwise the run fails with a clear message). Issues still labelled automatic-add-member / automatic-update-member are processed the same way. Co-Authored-By: Claude Opus 5.5 --- .github/ISSUE_TEMPLATE/add-member.yml | 187 ------------------ ...pdate-member.yml => add-update-member.yml} | 16 +- .github/workflows/process-issue-forms.yml | 12 +- src/python/add_update_member.py | 28 ++- 4 files changed, 30 insertions(+), 213 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/add-member.yml rename .github/ISSUE_TEMPLATE/{update-member.yml => add-update-member.yml} (90%) diff --git a/.github/ISSUE_TEMPLATE/add-member.yml b/.github/ISSUE_TEMPLATE/add-member.yml deleted file mode 100644 index 2d456423b..000000000 --- a/.github/ISSUE_TEMPLATE/add-member.yml +++ /dev/null @@ -1,187 +0,0 @@ -name: Add member profile 🧑‍🔬 -description: | - Use this form to add or update a lab member's profile on the website. -title: "[Add member]" -labels: ["automatic-add-member"] -assignees: - - octocat -body: - - type: markdown - attributes: - value: | - Please fill out as many fields as possible. This form will automatically generate a PR that will be reviewed by the maintainers. - - - type: input - id: name - attributes: - label: Name - description: Full name of the lab member - placeholder: "John Doe" - validations: - required: true - - - type: textarea - id: avatar - attributes: - label: "Avatar" - description: | - Path or URL or image of the avatar of the lab member. If it's a URL, it will be automatically resized and saved to `/assets/images/bio`. - - Tip: You can drag and drop an image, or click on the "M" button on the bottom right of the text area. - Otherwise, you can use imgur and give the **direct** link (e.g. https://i.imgur.com/{id}.png). - - placeholder: "Click here and drag an image to upload, or paste an image URL" - validations: - required: false - - - type: input - id: bio - attributes: - label: "Bio" - description: "A description of the lab member in one sentence (or less than 10 words)." - placeholder: "Works on Artificial Generic Intelligence" - - - type: "input" - id: note - attributes: - label: "Note" - description: "Any special note you want to include in one sentence. For example, fellowship, etc." - placeholder: "I'm special!" - - - type: markdown - attributes: - value: | - To have publications to be automatically updated, please provide both the semantic scholar ID and setting auto_update to True. - - - type: input - id: semantic_scholar_id - attributes: - label: "Semantic Scholar ID" - description: | - If you have a [Semantic Scholar](https://www.semanticscholar.org) ID, enter it here. This is highly recommend becasue it is used to automatically attribute a paper to the correct author. - placeholder: "145113126" - validations: - required: false - - - type: dropdown - id: auto_update_publications - attributes: - label: "Auto Update Publications" - description: Do you want your publications to be auto-updated? - multiple: false - options: - - "False" - - "True" - validations: - required: true - - - type: dropdown - id: current_role-type - attributes: - label: "Current Role Type" - description: What's the current role of this person? (set to Unaffilated for Alumni) - multiple: false - options: - - "Faculty" - - "Staff" - - "Postdoc" - - "Student" - - "Collaborator" - - "Unaffiliated" - validations: - required: true - - - type: input - id: current_role-title - attributes: - label: "Current Role Title" - description: What's the current title of this person? For students, please choose between ["PhD, "Master", "Undergraduate", "Intern"] - placeholder: "PhD" - validations: - required: true - - - type: "input" - id: current_role-affiliation - attributes: - label: "Current Role Affiliation" - description: "Affiliation" - placeholder: "Mila, McGill" - validations: - required: false - - - type: "dropdown" - id: current_role-research-directions - attributes: - label: "Current Role Research Directions" - description: "What research direction are you in" - multiple: true - options: - - "online-toxicity" - - "poli-sci" - - "online-crime" - - "temporal-graph-learning" - validations: - required: false - - - type: input - id: current_role-advisor - attributes: - label: "Current Role Advisor" - description: "For students, who is/are the advisor(s)? Separate multiple names with a comma." - placeholder: "John Doe Sr., Jane Doe" - validations: - required: false - - - type: "input" - id: current_role-start_date - attributes: - label: "Current Role Start Date" - description: "When did the lab member join the lab? MMM-YYYY or {Fall, Summer, Winter} YYYY" - placeholder: "Jan 2021" - validations: - required: true - - - type: "input" - id: github - attributes: - label: "GitHub" - description: "Full URL of the lab member's GitHub profile" - placeholder: "https://github.com/john-doe" - validations: - required: false - - - type: "input" - id: twitter - attributes: - label: "Twitter" - description: "Full URL of the lab member's Twitter profile" - placeholder: "https://twitter.com/john-doe" - validations: - required: false - - - type: "input" - id: scholar - attributes: - label: "Scholar" - description: "Full URL of the lab member's Google Scholar profile" - placeholder: "https://scholar.google.com/citations?user=" - validations: - required: false - - - type: "input" - id: linkedin - attributes: - label: "LinkedIn" - description: "Full URL of the lab member's LinkedIn profile" - placeholder: "https://www.linkedin.com/in/john-doe" - validations: - required: false - - - type: "input" - id: website - attributes: - label: "Website" - description: "Full URL of the lab member's website" - placeholder: "https://john-doe.github.io/" - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/update-member.yml b/.github/ISSUE_TEMPLATE/add-update-member.yml similarity index 90% rename from .github/ISSUE_TEMPLATE/update-member.yml rename to .github/ISSUE_TEMPLATE/add-update-member.yml index 989c9c16b..e2a98edd4 100644 --- a/.github/ISSUE_TEMPLATE/update-member.yml +++ b/.github/ISSUE_TEMPLATE/add-update-member.yml @@ -1,17 +1,19 @@ -name: Update member profile 🧑‍🔬 +name: Add or update member profile 🧑‍🔬 description: | - Use this form to update a lab member's profile on the website. -title: "[Update member]" -labels: ["automatic-update-member"] + Use this form to add a lab member to the website, or to update an existing profile. +title: "[Add/update member]" +labels: ["automatic-add-update-member"] assignees: - octocat body: - type: markdown attributes: value: | - *Only* fill out the required fields and the fields that you want to modify. Leave everything else blank. - - When updating a profile, it will match the profile with the same full `name`. If multiple people have the same full name, it will match the first one encountered. In this case, you might want to to either make the change manually or move an older profile to the bottom (both require editing the YAML file). + Profiles are matched by full `name`: + - **The name already exists:** only the fields you fill in are updated; everything left blank stays as it is. To change just a photo, fill in Name and Avatar. + - **The name is new:** a new profile is created. Please fill in at least *Current Role Type*, *Current Role Title* and *Current Role Start Date*. + + If multiple people have the same full name, the first one encountered is updated. In this case, either make the change manually or move an older profile to the bottom (both require editing the YAML file). This form will automatically generate a PR that will be reviewed by the maintainers. diff --git a/.github/workflows/process-issue-forms.yml b/.github/workflows/process-issue-forms.yml index 55244201e..787da869d 100644 --- a/.github/workflows/process-issue-forms.yml +++ b/.github/workflows/process-issue-forms.yml @@ -19,18 +19,12 @@ jobs: - name: Install Python requirements run: pip install -r src/python/requirements.txt + # One form adds or updates a member depending on whether the name exists; the older + # add/update labels are still accepted for issues opened before the forms were merged. - name: "Update _data/authors.yml with src/python/add_update_member.py" - if: github.event.label.name == 'automatic-add-member' + if: contains(fromJSON('["automatic-add-update-member", "automatic-add-member", "automatic-update-member"]'), github.event.label.name) env: ISSUE_BODY: ${{ github.event.issue.body }} - ACTION: Add member - run: python -m src.python.add_update_member - - - name: "Update _data/authors.yml with src/python/add_update_member.py" - if: github.event.label.name == 'automatic-update-member' - env: - ISSUE_BODY: ${{ github.event.issue.body }} - ACTION: Update member run: python -m src.python.add_update_member - name: "Create post in _posts/papers with src/python/add_update_publication.py" diff --git a/src/python/add_update_member.py b/src/python/add_update_member.py index adf7757e4..9be2bab26 100644 --- a/src/python/add_update_member.py +++ b/src/python/add_update_member.py @@ -162,7 +162,11 @@ def sort_by_lastname(authors: Dict) -> None: authors.insert(0, user, desc) -def main(parsed: Dict, action: str, site_data_dir: str = "_data/", image_dir: str = "assets/images/bio") -> Dict: +def main(parsed: Dict, action: Optional[str] = None, site_data_dir: str = "_data/", image_dir: str = "assets/images/bio") -> Dict: + """Add the member if the name is new, otherwise update only the fields filled in. + + `action` is kept for backwards compatibility and no longer changes the behaviour. + """ site_data_dir = Path(site_data_dir) profile = format_parsed_content(parsed) @@ -173,8 +177,18 @@ def main(parsed: Dict, action: str, site_data_dir: str = "_data/", image_dir: st name_to_username = {authors[username]["name"]: username for username in authors} - if action == "Add member" and profile["name"] not in name_to_username: + if profile["name"] not in name_to_username: + # New member + role = profile.get("current_role") or {} + if "type" not in role or "title" not in role: + raise ValueError( + f'{profile["name"]} is not on the website yet: to add them, fill in at least ' + '"Current Role Type" and "Current Role Title". To update an existing profile, ' + 'check that the name matches it exactly.' + ) profile.setdefault("auto_update_publications", False) + if "past_roles" in profile: + profile["past_roles"] = [profile["past_roles"]] username = profile["name"] if username in authors: n = 2 @@ -183,12 +197,7 @@ def main(parsed: Dict, action: str, site_data_dir: str = "_data/", image_dir: st username = k authors[username] = profile else: - # Update, or an "Add member" for someone already listed (e.g. a placeholder - # entry created by a maintainer): merge into the existing entry instead of - # creating a duplicate. - if profile["name"] not in name_to_username: - raise ValueError(f'{profile["name"]} not in authors') - + # Existing member: merge in only the fields that were filled in username = name_to_username[profile["name"]] authors[username] = merge_profile_data(authors[username], profile) @@ -215,6 +224,5 @@ def main(parsed: Dict, action: str, site_data_dir: str = "_data/", image_dir: st if __name__ == "__main__": issue_body = os.environ["ISSUE_BODY"] - action = os.environ["ACTION"] parsed = parse_issue_body(issue_body) - main(parsed, action) \ No newline at end of file + main(parsed) \ No newline at end of file