1Password / for-open-source

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

Set up application approval workflow and logic #925

Closed jodyheavener closed 3 months ago

jodyheavener commented 3 months ago

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

Summary

We are working on improvements to the 1Password for Open Source program. This PR continues sets up the workflow and logic to handle when an application is approved.

What's changed?

The focus of the changes here are related to when a reviewer has taken a look at the application, determined it is approved, and applies the status: approved label to the issue.

Testing

There are no new unit/integration tests in this PR (more testing setup underway). The manual testing flow to help debug and observe the behaviour when approving in the application processor has been updated. Here's how to test this out:

git checkout jh/approve-merge
make install_deps && make build_processor
./processor approve --test-issue <issue-name> 

You can use this against any of the test issues in the repo, but unless it has the status: approved label it will result in one of the following errors:

Issue closed

You'll receive the error

Error approving application: script run on closed issue

Issue not approved

You'll receive the error

Error approving application: script run on issue that does not have required 'status: approved' label

Application invalid

You'll receive the error

Error approving application: script run on issue with invalid application data:
- ... list of errors ...

It's worth noting that these are all considered edge cases but in theory are all still possible. All of these scenarios will not result in any comment from the bot or label changes.

Happy path

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

With this command you'll see a few things happen:

  1. The application is validated once again.
  2. The application contents are committed to the repository:
Output ``` Commiting the following contents to a file located at "data/6-testdb.json" with the commit message "Added "TestDB" to program": { "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, "approver_id": 123, "issue_number": 6, "created_at": "2023-07-12T19:49:35Z" } ```
  1. The bot will post a helpful message
Bot approval message ### 🎉 Your application has been approved Congratulations, @approver-username has approved your application! A promotion will be applied to your 1Password account shortly. If you haven't done so already, we highly recommend implementing a [recovery plan for your team](https://support.1password.com/team-recovery-plan/) in case access for a particular contributor is ever lost. You may add additional core contributors as you see fit. Finally, we'd love to hear more about your experience using 1Password in your development workflows! Feel free to join us over on the [1Password Developers Slack](https://join.slack.com/t/1password-devs/shared_invite/zt-15k6lhima-GRb5Ga~fo7mjS9xPzDaF2A) workspace. Welcome to the program and happy coding! 🧑‍💻
  1. The issue is closed