Cannot add teams to repo.yml

Đang mở
#809 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
github, javascript
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu với ví dụ .github/repos/Prequal.yml và tái hiện việc áp dụng một team hiện có hoặc một team đã được liên kết với repository trong app probot/settings tự lưu trữ. Theo dõi entry point thêm team và xác nhận rằng việc áp dụng cấu hình hoàn tất mà không gặp lỗi 422 của GitHub Enterprise.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Problem Description

What's Happening

We're managing repository-level team permissions using individual repo YAML files (e.g., Mobile.yml, Web.yml, infra.yml) under the .github/repos directory. We do not maintain any team configurations in settings.yml.

The intent is to explicitly grant certain teams (like all engineering teams) permissions to deploy to non-prod environments. For example:

# .github/repos/Prequal.yml

repository:
  name: Prequal
  teams:
    - name: SRE
      permission: maintain
    - name: "Engineering Members"
      permission: push

However, when applying these settings, we encounter the following error:

Error adding team: 422

API response:

{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "Team",
      "code": "unprocessable",
      "field": "data",
      "message": "Name must be unique for this org"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/teams/teams#create-a-team",
  "status": "422"
}

This seems to happen when the team already exists or is already associated with the repository.

Expected Behavior

We want to know if there's a way to skip adding a team if it already exists or is already associated with the repository, to avoid the 422 error. Ideally, the settings app should be idempotent in this case.


Context

  • GitHub App: Self-hosted instance of probot/settings
  • Platform: GitHub Enterprise (EMU)
  • Versions:
    • probot/settings: [please insert version]
    • GitHub Enterprise: [please insert version]

Ngôn ngữ chính
JavaScript
Star
942
Fork
238
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github-community-projects/safe-settings

Tất cả issue của github-community-projects/safe-settings

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.