1Password / for-open-source

Get a 1Password team account for free to support your open source initiatives!
1.63k stars 790 forks source link

Set up application labelling and commenting #924

Closed jodyheavener closed 6 months ago

jodyheavener commented 6 months ago

/dev/web/developer.1password.com/-/issues/1065

Summary

We are working on improvements to the 1Password for Open Source program. This PR continues from https://github.com/1Password/1password-teams-open-source/pull/918 and sets up application labelling and commenting from the bot account based on the application's status and validity.

What's changed?

The main change here is setting up what our "bot" account does in response to an issue. Now, when an application issue is opened or updated, we do the following:

Additionally the following was changed:

Testing

There are no new unit/integration tests just yet (but there will be), but there are several updates to the manual testing flow to help debug and validate the application processor, like the last issue. Here's how to use it:

git checkout jh/application-label-comment
make install_deps && make build_processor
./processor review --test-issue <issue-name> 

This command will print the application input it received and the parsed data.

Example output ``` [DEBUG] Using test issue 'valid-project' [DEBUG] Skipping GitHub Init [DEBUG] Parsed input data: { "Account URL": "testdb.1password.com", "Additional comments": "Thank you!", "Age confirmation": "- [X] Yes, this project is at least 30 days old", "Can we contact you?": "- [X] Yes, you may contact me", "Email": "wendyappleseed@example.com", "Event application": "- [ ] Yes, this application is for an event", "Homepage URL": "https://github.com/wendyappleed/test-db", "License URL": "https://github.com/wendyappleed/test-db/blob/main/LICENSE.md", "License type": "MIT", "Name": "Wendy Appleseed", "Non-commercial confirmation": "- [X] No, this account won't be used for commercial activity", "Number of team members/core contributors": "1", "Profile or website": "https://github.com/wendyappleseed/", "Project name": "TestDB", "Project role": "Core Maintainer", "Repository URL": "https://github.com/wendyappleed/test-db", "Short description": "TestDB is a free and open source, community-based forum software project.", "Team application": "- [ ] Yes, this application is for a team" } [DEBUG] Application data: { "account": "testdb.1password.com", "project": { "name": "TestDB", "description": "TestDB is a free and open source, community-based forum software project.", "contributors": 1, "home_url": "https://github.com/wendyappleed/test-db", "repo_url": "https://github.com/wendyappleed/test-db", "license_type": "MIT", "license_url": "https://github.com/wendyappleed/test-db/blob/main/LICENSE.md", "is_event": false, "is_team": false }, "applicant": { "name": "Wendy Appleseed", "email": "wendyappleseed@example.com", "role": "Core Maintainer", "id": 38230737 }, "can_contact": true, "issue_number": 6, "created_at": "2023-07-12T19:49:35Z" } ```

In addition to this information this will output the automated bot comment's message, as well as any labels being added or removed.

The following test issues are available:

valid-project

./processor review --test-issue valid-project

This is a valid application for a project. It will result in the status: reviewing label being added, and a helpful comment about what's next.

Bot comment ### ✅ Your application is valid
Application data... ```json { "account": "testdb.1password.com", "project": { "name": "TestDB", "description": "TestDB is a free and open source, community-based forum software project.", "contributors": 1, "home_url": "https://github.com/wendyappleed/test-db", "repo_url": "https://github.com/wendyappleed/test-db", "license_type": "MIT", "license_url": "https://github.com/wendyappleed/test-db/blob/main/LICENSE.md", "is_event": false, "is_team": false }, "applicant": { "name": "Wendy Appleseed", "email": "wendyappleseed@example.com", "role": "Core Maintainer", "id": 38230737 }, "can_contact": true, "issue_number": 6, "created_at": "2023-07-12T19:49:35Z" } ```
Thanks for applying! Next step: our team will review your application and may have follow-up questions. You can still make changes to your application and we'll process it again.

The valid-team and valid-event test issues will have a similar output.

valid-project-reviewing

./processor review --test-issue valid-project-reviewing

This is a valid application, where the application was previously valid. This will not result in any label changes.

Bot comment ### 👍 Application still valid
Application data... ```json { "account": "testdb.1password.com", "project": { "name": "TestDB", "description": "TestDB is a free and open source, community-based forum software project.", "contributors": 1, "home_url": "https://github.com/wendyappleed/test-db", "repo_url": "https://github.com/wendyappleed/test-db", "license_type": "MIT", "license_url": "https://github.com/wendyappleed/test-db/blob/main/LICENSE.md", "is_event": false, "is_team": false }, "applicant": { "name": "Wendy Appleseed", "email": "wendyappleseed@example.com", "role": "Core Maintainer", "id": 38230737 }, "can_contact": true, "issue_number": 6, "created_at": "2023-07-12T19:49:35Z" } ```
We've processed your updated application and everything still looks good.

valid-project-closed

./processor review --test-issue valid-project-closed

This is a valid application for a project, but the issue for the application is already closed and therefor cannot be modified in any way - processing aborted. This will not result in any label changes.

Bot comment Oops! This application is closed can no longer be processed. If this is an error, please reach out to [opensource@1password.com](mailto:opensource@1password.com).

valid-project-approved

./processor review --test-issue valid-project-approved

This is a valid application for a project, but it was already approved and therefor cannot be modified in any way - processing aborted. This will not result in any label changes.

Bot comment Oops! This application has been updated but has already been approved and can no longer be processed. If this is an error, please reach out to [opensource@1password.com](mailto:opensource@1password.com).

invalid-examples-1

./processor review --test-issue invalid-examples-1

This is an application that contains validation errors. It will result in the status: invalid label being added, and a comment that contains the errors that need to be addressed.

Bot comment ### ❌ Your application needs some work
Application data... ```json { "account": "foo", "project": { "name": "TestDB 🎁", "description": "TestDB is a free and open source, community-based forum software project.", "contributors": 0, "home_url": "@wendyappleed", "repo_url": "https://github.com/wendyappleed/test-db", "license_type": "MIT", "license_url": "https://github.com/wendyappleed/test-db/blob/main/LICENSE.md", "is_event": false, "is_team": false }, "applicant": { "name": "Wendy Appleseed", "email": "wendyappleseed@example.com", "role": "Lead Dev", "id": 38230737 }, "can_contact": true, "issue_number": 6, "created_at": "2023-07-12T19:49:35Z" } ```
The following issues need to be addressed: - **Application title** is missing project name - **Account URL** is invalid 1Password account URL - **Non-commercial confirmation** must be checked - **Project name** cannot contain emoji characters - **Number of team members/core contributors** could not be parsed into a number - **Homepage URL** is an invalid URL

The invalid-empty-body and invalid-no-responses test issues will have a similar output.