Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pizza generate insight command #179

Merged
merged 1 commit into from
Sep 12, 2024
Merged

feat: pizza generate insight command #179

merged 1 commit into from
Sep 12, 2024

Conversation

jpmcb
Copy link
Member

@jpmcb jpmcb commented Sep 12, 2024

Description

Refactors the existing interactive flow from pizza generate codeowners (after the codeowners file has been created) into its own command:

❯ ./build/pizza generate insight .
[jpmcb nickytonline brandonroberts zeucapua]
Do you want to add these codeowners to an OpenSauced Contributor Insight? (y/n): y
Adding codeowners to contributor insight

Access Contributor Insight on OpenSauced:
https://app.opensauced.pizza/workspaces/8718805b-66b8-4da5-887d-c37366b8e0da/contributor-insights/dfa8e053-f68a-47e9-ae09-fc13579ca4a5

Related Tickets & Documents

Closes #176

Steps to QA

  1. Build locally with just build
  2. Run command with ./build/pizza generate insight . in a directory with a CODEOWNERS file

Tier (staff will fill in)

  • Tier 1
  • Tier 2
  • Tier 3
  • Tier 4

@jpmcb jpmcb requested a review from a team September 12, 2024 15:14
@jpmcb jpmcb force-pushed the contrib-insight-command branch from 342ff57 to 235d883 Compare September 12, 2024 15:15
@brandonroberts
Copy link
Contributor

The command works good for me. How does this handle attribution groups vs usernames? If I have an open-sauced/engineering group of emails?

@jpmcb
Copy link
Member Author

jpmcb commented Sep 12, 2024

How does this handle attribution groups vs usernames?

It doesn't. It just uses a regex to look for the @ handle in CODEOWNERS files, grabs those, and uses them in the payload to the API.

The v2/workspaces/:id/userLists/:list-id API endpoint throws out logins that are invalid or 404 from GitHub.

For example, this request to the API:

curl -X 'PATCH' \
  'https://api.opensauced.pizza/v2/workspaces/8718805b-66b8-4da5-887d-c37366b8e0da/userLists/157b6ce1-c50d-438a-8648-050fbf662854' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <redacted>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Test test test",
  "is_public": false,
  "contributors": [
    {
      "login": "jpmcb"
    },
    {
      "login": "open-sauced/engineering"
    },
    {
      "login": "Brandon Roberts"
    }
  ]
}'

throws out the two logins that aren't actually logins.


Abit of a rough experience. In the future we could hit the v2/users endpoints to see if the list of users is valid or not and inform the users of the ones that are being ignored. But this works for MVP right now.

Copy link
Member

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@jpmcb jpmcb merged commit 7315a1d into beta Sep 12, 2024
9 checks passed
@jpmcb jpmcb deleted the contrib-insight-command branch September 12, 2024 18:24
open-sauced bot pushed a commit that referenced this pull request Sep 12, 2024
## [1.5.0-beta.1](v1.4.1-beta.1...v1.5.0-beta.1) (2024-09-12)

### 🍕 Features

* pizza generate insight command ([#179](#179)) ([7315a1d](7315a1d))

### 🐛 Bug Fixes

* Config path prefers local dir vs. home dir ([#184](#184)) ([859446a](859446a))
open-sauced bot pushed a commit that referenced this pull request Sep 16, 2024
## [1.5.0](v1.4.0...v1.5.0) (2024-09-16)

### 🐛 Bug Fixes

* Config path prefers local dir vs. home dir ([#184](#184)) ([859446a](859446a))
* Don't overwrite ldflags in justfile builds ([#171](#171)) ([e024687](e024687))

### 🍕 Features

* Cut 2.0.0 release ([#193](#193)) ([278a833](278a833))
* pizza generate insight command ([#179](#179)) ([7315a1d](7315a1d))
* Update README docs ([#186](#186)) ([99328aa](99328aa))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: move Contributor Insight interactive flow in pizza generate codeowners into its own command
3 participants